# 2574. Principles of Compiler

After learnt the Principles of Compiler,partychen thought that he can solve a simple expression problem.So he give you strings of less than 100 characters which strictly adhere to the following grammar (given in EBNF):

A:= ‘(‘ B’)’|’x’.

B:=AC.

C:={‘+’A}.

Can you solve them too?

### 输入格式

The first line of input gives the number of cases, N(1 ≤ N ≤ 100). N test cases follow.

The next N lines will each contain a string as described above.

### 输出格式

For each test case,if the expression is adapt to the EBNF above output “Good”,else output “Bad”.

### 样例

Input
3
(x)
(x+(x+x))
()(x)

Output
Good
Good


60 人解决，143 人已尝试。

77 份提交通过，共有 673 份提交。

5.6 EMB 奖励。