Parentheses

No attempts yetTime limit1sMemory limit128 MB

Problem

A Parenthesis String (PS) is a string made up of only the two bracket characters '(' and ')'. Among these, a string whose brackets are correctly matched is called a Valid Parenthesis String (VPS).

A VPS is defined as follows:

  • "()", a single pair of brackets, is a VPS.
  • If a string x is a VPS, then "(x)", which wraps x in one more pair of brackets, is also a VPS.
  • If two strings x and y are both VPS, then their concatenation "xy" is also a VPS.

For example, "(())()" and "((()))" are VPS, while "(()(", "(())()))", and "(()" are not.

Given a parenthesis string, decide whether it is a VPS and answer "YES" or "NO".

Input

The first line contains the number of test cases T. Each of the following T lines contains one parenthesis string. The length of each parenthesis string is between 2 and 50, inclusive.

Output

For each test case, print "YES" if the given parenthesis string is a Valid Parenthesis String (VPS), or "NO" otherwise, one result per line in the input order.