Hidden Rook
시간 제한15초메모리 제한256 MB
n 곱하기 m 체스판에 숨은 룩의 위치를, 부분 직사각형에서 룩이 공격하는 칸 수를 묻는 질의를 최대 네 번 써서 찾는다.
문제
This problem is interactive.
Roman hid a rook on an chessboard. You need to find its exact position. You can ask Roman the following question at most 4 times: "How many cells , where and , are under the hidden rook's attack?" A rook attacks all cells in the same row or column, including its own cell.
입력
The first line contains an integer , the number of test cases ().