/**
 * (C) 2006 CodeCup.nl
 */

import java.io.BufferedReader;

import java.io.InputStreamReader;


public class OnTheRun {

    /**
     * MAIN
     */
    public static void main(String[] args) throws Exception {
        OnTheRun otr = new OnTheRun();
        otr.doGame();
    }

    void doGame() throws Exception {
        connectRead();
        stdin = new BufferedReader(new InputStreamReader(System.in));
        String line = stdin.readLine();
        if (line.equals("Fugitive")) {
            fugMain();
        } else if (line.equals("Detectives")) {
            detsMain();
        }
    }

    static final int N_DETS = 4;
    static final int N_ROUNDS = 10;
    static final int N_TURNS = 5;
    int[] detsPos = new int[N_DETS];
    int fugPos;
    char[] fugTicket = new char[N_TURNS];
    int round;
    int turn;
    BufferedReader stdin;

    /**
     * READ CONNECT.TXT INFO HERE
     */
    void connectRead() {
        // TODO

    }

    /**
     * FUGITIVE:
     * CALCULATE INITIAL POSITION
     */
    void fugInitialPos() {
        // TODO

        fugPos = 0;
    }

    /**
     * FUGITIVE:
     * CALCULATE NEW POSITION AND TICKET USED
     */
    void fugNewPos() {
        // TODO

        fugPos = 0;
        fugTicket[turn] = 'C';
    }

    /**
     * FUGITIVE:
     * MAIN
     */
    void fugMain() throws Exception {
        // READ INITAL DETECTIVES POSITIONS

        for (int i = 0; i < N_DETS; i++) {
            detsPos[i] = Integer.parseInt(stdin.readLine());
        }
        // CALCULATE INITIAL POSITION AND PRINT

        fugInitialPos();
        System.out.println(fugPos);
        System.out.flush();

        // PLAY 10 ROUNDS OF EACH 5 TURNS

        for (round = 0; round < 10; round++) {
            for (turn = 0; turn < 5; turn++) {

                // CALCULATE POSITION AND PRINT

                fugNewPos();
                System.out.println(fugTicket[turn] + " " + fugPos);
                System.out.flush();

                // READ DETECTIVES POSITIONS

                for (int i = 0; i < N_DETS; i++) {
                    detsPos[i] = Integer.parseInt(stdin.readLine());
                }
            }
        }
    }

    /**
     * DETECTIVES:
     * CALCULATE INITIAL POSITIONS
     */
    void detsInitialPos() {
        // TODO

        for (int i = 0; i < N_DETS; i++) {
            detsPos[i] = 0;
        }
    }

    /**
     * DETECTIVES:
     * CALCULATE NEW POSITIONS
     */
    void detsNewPos() {
        // TODO

        // NOTE: turn IS A ZERO BASED INDEX TO fug_tickets TO ITERATE OVER fug_tickets USE THE <= OPERATOR

        for (int i = 0; i < N_DETS; i++) {
            detsPos[i] = 0;
        }
    }

    /**
     * DETECTIVES:
     * MAIN
     */
    void detsMain() throws Exception {

        // CALCULATE INITAL POSITIONS AND PRINT

        detsInitialPos();
        for (int i = 0; i < N_DETS; i++) {
            System.out.println(detsPos[i]);
        }
        System.out.flush();

        // READ INITIAL FUGITIVE POSITION

        fugPos = Integer.parseInt(stdin.readLine());

        // PLAY 10 ROUNDS OF EACH 5 TURNS

        for (round = 0; round < N_ROUNDS; round++) {
            for (turn = 0; turn < N_TURNS - 1; turn++) {

                // READ FUGITVE TICKET

                fugTicket[turn] = stdin.readLine().charAt(0);

                // CALCULATE POSITIONS AND PRINT

                detsNewPos();
                for (int i = 0; i < N_DETS; i++) {
                    System.out.println(detsPos[i]);
                }
                System.out.flush();
            }

            // LAST TURN OF THIS ROUND

            // READ FUGITVE TICKET AND POSITION

            String line = stdin.readLine();
            fugTicket[turn] = line.charAt(0);
            fugPos = Integer.parseInt(line.substring(2));

            // CALCULATE POSITIONS AND PRINT

            detsNewPos();
            for (int i = 0; i < N_DETS; i++) {
                System.out.println(detsPos[i]);
            }
            System.out.flush();
        }
    }

}


syntax highlighted by Code2HTML, v. 0.9.1