Chessboard Game
시간 제한1초메모리 제한1024 MB
위나 왼쪽으로만 한 칸씩 움직이며 경계 칸의 천국문과 지옥문을 만나는 게임에서, 여러 시작 칸 각각에 대해 선공이 이기는지 판정한다.
문제
bobo and yiyi are playing a game on a chessboard with rows and columns. Rows are numbered by from top to bottom, while columns are numbered by from left to right.
Cells are special. They may contain a "heaven gate" or "hell gate". People who enters a "heaven gate" immediately wins. However, the one who enters a "hell gate" dies and gives the victory to the other.
The game lasts for rounds. In each round, a chess is placed on cell initially. bobo and yiyi moves alternatively. bobo goes first. In one move, chess can be moved one cell upward or leftward.
Determine if bobo can win for each round. You know, bobo and yiyi are really clever guys ...
입력
The first line contains integers ().
The second line contains integers (). If cell contains a "heaven gate", then . If cell contains a "hell gate" instead, then .
The third line contains integers (). If cell contains a "heaven gate", then . If cell contains a "hell gate" instead, then .
Each of the last lines contains integers ().
출력
For each rounds, print "Yes" if bobo can win. Print "No" otherwise.