#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, an = 0;
  string h, c[105];
  cin >> n;
  cin >> h;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    int j = 5;
    int k = 0;
    while (c[i][j] == h[k] && k < 3 && j < 8) {
      j++;
      k++;
    }
    if (k == 3 || j == 8) ans++;
    k = 0;
    j = 0;
    while (c[i][j] == h[k] && k < 3 && j < 3) {
      j++;
      k++;
    }
    if (k == 3 || j == 3) an++;
  }
  if (ans == an) {
    cout << "home";
  } else
    cout << "contest";
  return 0;
}
