=====Problem Statement=====
You are given a string S.
Your task is to find out whether is a valid regex or not.
=====Input Format=====
The first line contains integer T, the number of test cases.
The next T lines contains the string S.
=====Constraints=====
0<T<100
=====Output Format=====
Print "True" or "False" for each test case without quotes.
import re
n = int(input())
for i in range(n):
    s = input()
    try:
        re.compile(s)
        print(True)
    except Exception as e:
        print(False)

import re
n = int(input())
for i in range(n):
    s = input()
    try:
        re.compile(s)
        print(True)
    except Exception as e:
        print(False)
