content: <<<<<<< HEAD
  import java.util.Scanner;
  import java.util.regex.*;
  
  public class PatternSyntaxChecker
  {
  	public static void main(String[] args){
  		Scanner in = new Scanner(System.in);
  		int testCases = Integer.parseInt(in.nextLine());
  		while(testCases-- > 0){
  			String pattern = in.nextLine();
            	try {
                  Pattern.compile(pattern);
                  System.out.println("Valid");
              } catch (PatternSyntaxException e) {
                  System.out.println("Invalid");
              } 
  		}
          in.close();
  	}
  =======
  import java.util.Scanner;
  import java.util.regex.*;
  
  public class PatternSyntaxChecker
  {
  	public static void main(String[] args){
  		Scanner in = new Scanner(System.in);
  		int testCases = Integer.parseInt(in.nextLine());
  		while(testCases-- > 0){
  			String pattern = in.nextLine();
            	try {
                  Pattern.compile(pattern);
                  System.out.println("Valid");
              } catch (PatternSyntaxException e) {
                  System.out.println("Invalid");
              } 
  		}
          in.close();
  	}
  >>>>>>> cded02a3519e594c508657d8c349c299c5e1dfcc
  }