#include <bits/stdc++.h>
using namespace std;
template <class T>
T emin(T &a, T b) {
  if (a > b) a = b;
  return a;
}
template <class T>
T emax(T &a, T b) {
  if (a < b) a = b;
  return a;
}
int n;
string s, x, y;
map<string, int> M;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  while (n--) {
    cin >> x;
    string rs = "";
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '-' || s[i] == '>') {
        rs = "";
        continue;
      }
      rs += s[i];
      M[rs]++;
    }
  }
  cout << (M[s] & 1 ? "contest" : "home");
}
