#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string home;
  cin >> home;
  map<string, int> mymap;
  while (n--) {
    string a;
    cin >> a;
    string depa;
    string arr;
    depa += a[0];
    depa += a[1];
    depa += a[2];
    arr += a[5];
    arr += a[6];
    arr += a[7];
    if (mymap.find(depa) == mymap.end())
      mymap[depa] = 1;
    else
      mymap[depa]++;
    if (mymap.find(arr) == mymap.end())
      mymap[arr] = -1;
    else
      mymap[arr]--;
  }
  map<string, int>::iterator it;
  for (it = mymap.begin(); it != mymap.end(); ++it)
    if (it->second > 0) {
      cout << "contest";
      return 0;
    }
  cout << "home";
}
