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