#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long int n, f = 0, e = 0;
  cin >> n;
  string w, s;
  cin >> w;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s.find(w) == 0 && s.find(w) != -1) {
      f++;
    }
    if (s.find(w) == 5 && s.find(w) != -1) {
      e++;
    }
  }
  if (e == f) {
    cout << "home";
  } else {
    cout << "contest";
  }
}
