import sys

"""
============================================================
 Domineering Sample Agent
 ------------------------------------------------------------
 - Board size: 8x8 (1-indexed)
 - This agent plays the lexicographically smallest legal move found on each turn.
============================================================
"""

weight = [[0] * 9 for _ in range(9)]  # 1-based
board = [[0] * 9 for _ in range(9)]   # 1-based
turn = 0


# ------------------------------------------------------------
# Find the first legal move available for the current player.
# Returns (x, y)
# ------------------------------------------------------------
def find_move(current_turn):
    if current_turn == 1:
        for i in range(1, 9):
            for j in range(1, 8):
                if board[i][j] != 0:
                    continue
                if board[i][j + 1] != 0:
                    continue
                return (i, j)
        return (-1, -1)
    else:
        for i in range(1, 8):
            for j in range(1, 9):
                if board[i][j] != 0:
                    continue
                if board[i + 1][j] != 0:
                    continue
                return (i, j)
        return (-1, -1)


# ------------------------------------------------------------
# Apply the player's move to the local board state.
# ------------------------------------------------------------
def apply_move(x, y, current_turn):
    if x == -1 and y == -1:
        return
        
    if current_turn == 1:
        assert 1 <= x <= 8
        assert 1 <= y <= 7
        assert board[x][y] == 0
        assert board[x][y + 1] == 0
        board[x][y] = current_turn
        board[x][y + 1] = current_turn
    else:
        assert 1 <= x <= 7
        assert 1 <= y <= 8
        assert board[x][y] == 0
        assert board[x + 1][y] == 0
        board[x][y] = current_turn
        board[x + 1][y] = current_turn


# ------------------------------------------------------------
# Main event loop: handles protocol commands and moves.
# ------------------------------------------------------------
def main():
    global turn

    # 1. 초기 가중치 입력 처리 (총 64개의 정수)
    tokens = []
    while len(tokens) < 64:
        line = sys.stdin.readline()
        if not line:
            break
        tokens.extend(line.split())
        
    idx = 0
    for i in range(1, 9):
        for j in range(1, 9):
            if idx < len(tokens):
                weight[i][j] = int(tokens[idx])
                idx += 1

    # 2. 메인 이벤트 루프
    while True:
        line = sys.stdin.readline()
        if not line:
            break
            
        line = line.strip()
        if not line:
            continue
            
        parts = line.split()
        cmd = parts[0]
        
        if cmd == "READY":
            role = parts[1]
            turn = 1 if role == "FIRST" else 2
            print("OK", flush=True)
            
        elif cmd == "TURN":
            # t1, t2는 사용하지 않으므로 파싱 생략
            x, y = find_move(turn)
            apply_move(x, y, turn)
            print(f"MOVE {x} {y}", flush=True)
            
        elif cmd == "OPP":
            x = int(parts[1])
            y = int(parts[2])
            # t2는 사용하지 않으므로 파싱 생략
            apply_move(x, y, turn ^ 3)
            
        elif cmd == "FINISH":
            break


if __name__ == "__main__":
    main()