#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INF = 1e9 + 1;
int n, k;
string base, s[101];
bool prov(string a, string b) {
  int k = a.find(b);
  if (k == 0)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  cin >> base;
  int one = 0, two = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    if (prov(s[i], base)) {
      ++one;
    } else
      ++two;
  }
  if (one == two) {
    cout << "home";
  } else
    cout << "contest";
  return 0;
}
