#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  m = n;
  string home;
  cin >> home;
  string s;
  int cnt = 0;
  while (n-- > 0) {
    cin >> s;
    if (s.substr(5, 3) == home) cnt++;
  }
  if (cnt * 2 != m)
    cout << "contest";
  else
    cout << "home";
  return 0;
}
