Description

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

(a) 該字串為一個空字串

(b) if A and B are correct, AB is correct,

(b) 如果A和B都為正確的運算式,則AB也為正確的運算式

(c) if A is correct, (A) and [A] is correct.

(c) 如果A為正確的運算式,則(A)及〔A〕都為正確的運算式

Write a program that takes a sequence of strings of this type and check their correctness. Your program can assume that the maximum string length is 128.

現在,請你寫一支程式可以讀入這類字串並檢查它們是否為正確的運算式。字串的最大長度為 128 個字元。

Input

Input contains a positive integer n and a sequence of n strings of parentheses ‘()’ and ‘[]’, one string a line.

輸入的第一列為正整數 n ,代表接下來有 n 列為包含'()'和'[]'的字串,一個字串一行。

Output

A sequence of ‘Yes’ or ‘No’.

請輸出 ‘Yes’ 或 ‘No’。

Sample Input 1

3
([])
(([()])))
([()[]()])()

Sample Output 1

Yes
No
Yes