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

#include <stdio.h>
#include <string.h>

#define N_DETS 4

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

/**
 * FUGITIVE:
 * CALCULATE INITIAL POSITION
 */
int fug_initial_pos(int dets_pos[]) {
  // TODO
  return 0;
}

/**
 * FUGITIVE:
 * CALCULATE NEW POSITION AND TICKET USED
 */
void fug_new_pos(int dets_pos[], int *fug_pos, char *fug_ticket) {
  // TODO
  *fug_pos = 0;
  *fug_ticket = 'C';
}

/**
 * FUGITIVE:
 * MAIN
 */
void fug_main() {
  int round;
  int turn;
  int i;
  int dets_pos[N_DETS];
  int fug_pos;
  char fug_ticket;

  // READ INITAL DETECTIVES POSITIONS
  for (i = 0; i < N_DETS; i++) scanf("%d", dets_pos + i);

  // CALCULATE INITIAL POSITION AND PRINT
  fug_pos = fug_initial_pos(dets_pos);
  printf("%d\n", fug_pos);
  fflush(stdout);

  // PLAY 10 ROUNDS OF EACH 5 TURNS
  for (round = 0; round < 10; round++) {
    for (turn = 0; turn < 5; turn++) {

      // CALCULATE POSITION AND PRINT
      fug_new_pos(dets_pos, &fug_pos, &fug_ticket);
      printf("%c %d\n", fug_ticket, fug_pos);
      fflush(stdout);

      // READ DETECTIVES POSITIONS
      for (i = 0; i < N_DETS; i++) scanf("%d", dets_pos + i);
    }
  }
}

/**
 * DETECTIVES:
 * CALCULATE INITIAL POSITIONS
 */
void dets_initial_pos(int dets_pos[]) {
  // TODO
  int i;
  for (i = 0; i < N_DETS; i++) dets_pos[i] = 0;
}

/**
 * DETECTIVES:
 * CALCULATE NEW POSITIONS
 */
void dets_new_pos(int fug_pos, int turn, char fug_tickets[], int dets_pos[]) {
  // TODO
  // NOTE: turn IS A ZERO BASED INDEX TO fug_tickets TO ITERATE OVER fug_tickets USE THE <= OPERATOR
  int i;
  for (i = 0; i < N_DETS; i++) dets_pos[i] = 0;
}

/**
 * DETECTIVES:
 * MAIN
 */
void dets_main() {
  int round;
  int turn;
  int i;
  int dets_pos[N_DETS];
  int fug_pos;
  char fug_tickets[5];

  // CALCULATE INITAL POSITIONS AND PRINT
  dets_initial_pos(dets_pos);
  for (i = 0; i < N_DETS; i++) printf("%d\n", dets_pos[i]);
  fflush(stdout);

  // READ INITIAL FUGITIVE POSITION
  scanf("%d", &fug_pos);

  // PLAY 10 ROUNDS OF EACH 5 TURNS
  for (round = 0; round < 10; round++) {
    for (turn = 0; turn < 4; turn++) {

      // READ FUGITVE TICKET
      scanf("%c", fug_tickets + turn);

      // CALCULATE POSITIONS AND PRINT
      dets_new_pos(fug_pos, turn, fug_tickets, dets_pos);
      for (i = 0; i < N_DETS; i++) printf("%d\n", dets_pos[i]);
      fflush(stdout);
    }

    // LAST TURN OF THIS ROUND
    // READ FUGITVE TICKET AND POSITION
    scanf("%c %d", fug_tickets + turn, &fug_pos);

    // CALCULATE POSITIONS AND PRINT
    dets_new_pos(fug_pos, turn, fug_tickets, dets_pos);
    for (i = 0; i < N_DETS; i++) printf("%d\n", dets_pos[i]);
    fflush(stdout);
  }
}

/**
 * MAIN
 */
const int main(const int argc, char *const argv[]) {
  char buf[16];
  
  connect_read();

  scanf("%s", buf);
  if (strcmp(buf, "Fugitive") == 0) {
    fug_main();
  } else if (strcmp(buf, "Detectives") == 0) {
    dets_main();
  } else {
    return 1;
  }
  return 0;
}



syntax highlighted by Code2HTML, v. 0.9.1