import java.util.*;
import java.io.*;

public class juggle
{	public static void main(String[] args) throws IOException
	{	Scanner s = new Scanner( new File("juggleTest.in"));
		int dataSets = Integer.parseInt(s.nextLine());
		//System.out.println( dataSets );
		for(int i = 0 ; i < dataSets; i++)
		{	String th = s.nextLine();
			int[] lands = new int[50];
			for(int j = 0; j < th.length(); j++)
			{	int ht = Integer.parseInt(th.charAt(j) + "");
				lands[ j + ht + 1 ]++;
		    }
		    boolean valid = true;
		    for(int j = 0; j < lands.length && valid; j++)
		    {	if( lands[j] > 1)
		    	{	System.out.println("DROPPED " + (lands[j] - 1) + "at step " + j);
		    		valid = false;
				}
			}
			if( valid )
			{	System.out.println( "VALID" );
			}
		}

	}

}