#include <bits/stdc++.h>
using namespace std;
bool cmp(char *a, char *b) {
  for (int i = 0; i < 3; i++) {
    if (a[i] != b[i]) return false;
  }
  return true;
}
int main() {
  int status = 0;
  int count;
  char home[4];
  cin >> count;
  cin >> home;
  char ticket[9];
  for (int i = 0; i < count; i++) {
    cin >> ticket;
    if (cmp(ticket, home)) status++;
    if (cmp(ticket + 5, home)) status--;
  }
  if (status > 0)
    cout << "contest";
  else
    cout << "home";
  return 0;
}
