#include <bits/stdc++.h>
using namespace std;
map<string, int> mp1;
map<string, int> mp2;
int main() {
  int n;
  string home;
  string x;
  cin >> n;
  cin >> home;
  for (int i = 0; i < n; i++) {
    cin >> x;
    string tmp = "";
    for (int j = 0; j < x.length(); j++) {
      if (x[j] == '-') {
        j += 2;
        mp1[tmp]++;
        tmp = "";
      }
      tmp += x[j];
    }
    mp2[tmp]++;
  }
  int flag = 1;
  if (mp1[home] > mp2[home]) flag = 0;
  if (flag == 1)
    cout << "home";
  else
    cout << "contest";
}
