#include <bits/stdc++.h>
using namespace std;
long long arr[100100], n, ans;
string s, s1;
int main() {
  int m1, countleft = 0, countright = 0;
  cin >> n;
  cin >> s;
  int m = s.length();
  for (int i = 0; i < n; i++) {
    cin >> s1;
    m1 = s1.length();
    if (s1[0] == s[0] && s1[1] == s[1] && s1[2] == s[2]) countleft++;
    if (s1[m1 - 1] == s[m - 1] && s1[m1 - 2] == s[m - 2] &&
        s1[m1 - 3] == s[m - 3])
      countright++;
  }
  if (countleft == countright)
    cout << "home" << endl;
  else
    cout << "contest" << endl;
  return 0;
}
