#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string home;
  cin >> home;
  vector<string> current(n);
  vector<string> st(n);
  for (int i = 0; i < n; i++) {
    string c;
    cin >> c;
    string d;
    for (int i = 0; i < 3; i++) {
      d += c[i];
    }
    if (d != home) {
      bool yep = 0;
      int i = 0;
      while (i < current.size()) {
        if (d == current[i]) {
          current.erase(current.begin() + i);
          yep = 1;
        }
        i++;
      }
      if (!yep) st.insert(st.begin(), d);
    } else {
      d.clear();
      for (int i = 5; i < 8; i++) {
        d += c[i];
      }
      bool r = 1;
      int i = 0;
      while (i < st.size()) {
        if (d == st[i]) {
          r = 0;
          st.erase(st.begin() + i);
        }
        i++;
      }
      if (r) {
        current.insert(current.begin(), d);
      }
    }
  }
  if (n % 2 == 0)
    cout << "home";
  else
    cout << "contest";
  cin.get();
  cin.get();
  return 0;
}
