#HARISHPUZZLE. Harish and his rooks puzzle

Harish and his rooks puzzle

Harish is playing Eight Rooks Puzzle. In this puzzle, he must put exactly eight rooks onto an 8x8 chessboard. No two rooks must be in the same row, and no two rooks must be in the same column.

You are given a 8 × 8 board. The j-th column of the i-th row of board is either 'R' or '.'. If this is 'R', the cell in row i, column j contains a rook. Otherwise the cell doesn't contain a rook. Determine whether Harish solved the puzzle correctly. If he solved the puzzle correctly, print "YES". Otherwise print "NO".

Input

T - Number of test cases

Each test case contains a 8 × 8 character array indicating the chess board.

Each character in board will be either 'R' or '.'

Output

YES or NO indicating whether he has solved the puzzle.

Example

Input:

2 R....... .R...... ..R..... ...R.... ....R... .....R.. ......R. .......R

......R. ....R... ...R.... .R...... R....... .......R ..R..... .......R

Output: YES NO

</p>