HARISH_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 x 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 x 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

hide comments
lumaks_69: 2021-12-30 19:58:41

he must put EXACTLY eight rooks onto an 8x8 chessboard. costed me 3 wa's

aadarsh45: 2019-02-17 20:25:10

simple but do with carefully .

Last edit: 2019-02-17 20:25:38
shadan_amir1: 2019-01-09 22:46:38

For c and c++, ASCII code for enter and space is the key!
Nice question, btw :)

nadstratosfer: 2017-08-19 21:30:23

Make sure you ignore the blanklines in input when solving with Python.

drodumbell: 2017-04-30 16:33:28

AC in one GO. EZ

hanstan: 2017-02-18 10:36:50

Really simple one XD. Ac in 1 go...

holmesherlock: 2017-02-11 20:40:15

really simple but only if you avoid silly mistakes,,

ks1999: 2017-01-27 18:29:18

is it possible to get AC?
Edit: It is :D

Last edit: 2020-04-22 03:12:24
vengatesh15: 2017-01-24 19:08:52

simple problem.. AC in 1 go :-)


Added by:gohan
Date:2016-02-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA