#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
  int n, i, res;
  string a[105];
  while (scanf("%d", &n) != EOF) {
    cin >> a[0];
    mp.clear();
    for (i = 1; i <= n; i++) {
      cin >> a[i];
      mp[a[i]]++;
    }
    res = 0;
    for (i = 1; i <= n; i++) {
      if (mp[a[i]] == 0) continue;
      mp[a[i]]--;
      swap(a[i][0], a[i][5]);
      swap(a[i][1], a[i][6]);
      swap(a[i][2], a[i][7]);
      if (mp[a[i]] == 0) {
        res = 1;
        break;
      }
      mp[a[i]]--;
    }
    if (res == 0)
      puts("home");
    else
      puts("contest");
  }
  return 0;
}
