#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n;
  string s, s1, s2, s3;
  cin >> n;
  cin >> s;
  vector<string> v;
  for (i = 0; i < n; i++) {
    cin >> s1;
    s2 = s1.substr(0, 3);
    s3 = s1.substr(5, 8);
    if (s2 == s)
      v.push_back(s3);
    else
      v.push_back(s2);
  }
  if (n % 2 != 0) {
    cout << "contest";
    return 0;
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size() - 1; i++) {
    if (v[i] == v[i + 1]) {
      i++;
    } else {
      cout << "contest";
      return 0;
    }
  }
  cout << "home";
  return 0;
}
