You are given a string consisting of parentheses () and []. A string of this type is said to be correct:
(a)if it is the empty string
(b)if A and B are correct, AB is correct,
(c)if A is correct, (A) and [A] is correct.
Write a program that takes a sequence of strings of this type and check their correctness.
Note: Some test cases may have spaces between brackets and some might not. Even if there are spaces, the answers should match with the one without spaces.
Input:
First line contains T, number of test cases Each test case consists of a single line with a string consisting of ( or ) or [ or ].
Output:
For each test case, output Yes or No
Constraints:
1 <= T <= 1000 0 < Length of each String <= 128