SP139 MAZE - The Long and Narrow Maze

Description

Consider a maze consisting of 3 rows of n square blocks each. The passageways in every block match one of three possible patterns, numbered 0 (empty), 1 (straight) and 2 (bent), as depicted below. ![Illustration of possible patterns](https://cdn.luogu.com.cn/upload/vjudge_pic/SP139/a4d1f6738565cd7ab80930a025fafbf84614ba48.png) Your task is to determine whether it is possible to create a passage in a given maze, with an entrance at the left end and an outlet at the right end of the maze, only by rotating some of the squares of the maze by a multiple of 90 degrees.

Input Format

The input begins with the integer t, the number of test cases. Then t test cases follow. Each test case begins with a line containing a single integer n - the number of squares in one row of the maze (1

Output Format

For each test case output the word yes if it is possible to rotate the squares so as to form a connection between the left and right edge, and the word no in the opposite case.