Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Chessman
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 1499Accepted: 633

Description

There's an n × 1 chessboard filled with some chessman, where n is infinity. For each chessman, you can make any move of the following:

1.Jump to the 4th grid on the right or left, if that grid is empty. For example:
...*........
=>
.......*....

...****.....
=>
....****....

....*.**....
=>
...**.*.....

2. Jump to the 3rd grid on the right, if that grid is empty, as well as the second and the first grid on the right has and has not a chessman respectively. Then, after this the junp is taken, the first grid the chessman jumped over will have a chessman, and the second grid the chessman jumped over will be empty. For example:

...*.*.....
=>
....*.*....

3.Jump to the 2nd grid on the right, if that grid is empty and the grid the chessman is about to jump over has a chessman. Then, the grid the chessman jumped over will be empty. For example:

...**.....
=>
.....*....

Given the first 30 girds on the left (has or has not chessman) of two chessboards, the rest grids being all empty, decide whether the first chessboard can be changed to the second chessboard with those three kinds of moves listed above?

Input

The first line of the input is the number of test cases. For each case there are two lines. Each line contains 30 characters. '.' represents empty grid. '*' represents a chessman. There is a blank line before each test case.

Output

For each test case output the answer on a line: "YES" or "NO".  

Sample Input

6

........................*.....
.........................*....

......*.......*...............
.........................*....

******************************
................**............

*...*..**.....................
...........................***

*******.****.**************.**
..**...*..*..*...**.*...**.*..

*******.****.**************.**
..**...**.*..*...**.*...**.*..

Sample Output

NO
NO
YES
NO
YES
NO

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator