#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, k1 = 0, k2 = 0;
  cin >> a;
  string h;
  cin >> h;
  string *s = new string[a];
  for (int i = 0; i < a; i++) {
    cin >> s[i];
    if (s[i].substr(s[i].size() - 3, 3) == h)
      k1++;
    else
      k2++;
  }
  if (k1 == k2)
    cout << "home";
  else
    cout << "contest";
  return 0;
}
