#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int status = 0;
  string home;
  cin >> home;
  while (n--) {
    string f;
    cin >> f;
    string from = f.substr(0, 3);
    string to = f.substr(5);
    debug() << " ["
            << "from"
               ": "
            << (from) << "] "
            << " ["
            << "to"
               ": "
            << (to) << "] ";
    if (from == home) status++;
    if (to == home) status--;
  }
  if (status == 0)
    cout << "home" << endl;
  else
    cout << "contest" << endl;
  return 0;
}
