#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0;
  string t;
  for (int i = 0; i < n; i++) {
    cin >> t;
    if (s[0] == t[5] && s[1] == t[6] && s[2] == t[7]) cnt++;
  }
  if (cnt * 2 == n)
    cout << "home";
  else
    cout << "contest";
  return 0;
}
