#include <bits/stdc++.h>
using namespace std;
int N, M, A[200000];
string s;
string c[200000], b[200000];
int main() {
  std::ios::sync_with_stdio(false);
  cin >> N;
  cin >> s;
  int x = 0, y = 0;
  for (int i = 1; i <= N; i++) {
    cin >> c[i];
    if (c[i][0] == s[0] && c[i][1] == s[1] && c[i][2] == s[2]) x++;
    if (c[i][5] == s[0] && c[i][6] == s[1] && c[i][7] == s[2]) y++;
  }
  if (x == y)
    cout << "home";
  else
    cout << "contest";
  return 0;
}
