The zombies have cornered you and your team. There's no hope...
But wait! Suddenly, they all stop advancing and offer you a deal. As it turns out, the zombies are having trouble finding good-tasting brains—by which they mean smart brains (nothing is more disgusting to a zombie than the brains of a communications major). While your brains would be very delicious, the zombies realize they could put you to better use helping find other smart brains. Here's the deal: help the zombies determine whether a given brain is smart (and therefore tasty) or not, and they will let your team go—at least for now.
Being the big-brained team that you are, you quickly determine that a brain is smart if it can provide the correct answer to a given Boolean expression. You compile a list of Boolean expressions and begin testing each one on a different brain.
Every Boolean expression is deterministic and defined recursively as follows:
expression '(' (value or expression) operation (value or expression) ')'
value 't' or 'f'
operation '' or '|'
Any value or expression can optionally be preceded by a '!'.
Expressions contain no characters other than those listed below. The meaning of each is:
'' is AND. is true if and are both true; otherwise, false.
'|' is OR. is false if and are both false; otherwise, true.
'!' is NOT. is false if is true; otherwise, true.
'(' and ')' are parentheses enclosing expressions. All expressions inside parentheses are evaluated first. Every '(' has a corresponding ')'.
't' and 'f' mean true and false, respectively.
The first line contains an integer such that 0 < x \leq 10000. Each of the next lines contains a Boolean expression (up to characters), a space, an equals sign '=', another space, and the test brain's evaluation ('t' or 'f').
For each test brain, print one line in the format:
brain number: Good brain or brain number: Bad brain
Print Good brain if the provided answer is correct, otherwise print Bad brain.
Once you are finished, you'd better start running as fast as you can—the zombies will only give you so much of a head start for your help.
Example 1