#include <bits/stdc++.h>
using namespace std;
vector<string> vc1, vc2;
bool gone[110][110];
map<pair<string, string>, int> mp;
int main() {
  int n, i, j;
  string s1, s2, s, home;
  bool flag;
  cin >> n;
  cin >> home;
  for (i = 0; i < n; i++) {
    cin >> s;
    s1 = "";
    s2 = "";
    for (j = 0; j < 3; j++) s1 += s[j];
    for (j = 5; j < 8; j++) s2 += s[j];
    vc1.push_back(s1);
    vc2.push_back(s2);
    mp[pair<string, string>(s1, s2)]++;
  }
  for (i = 0; i < n; i++) {
    if (mp[pair<string, string>(vc1[i], vc2[i])] !=
        mp[pair<string, string>(vc2[i], vc1[i])]) {
      printf("contest\n");
      return 0;
    }
  }
  printf("home\n");
  return 0;
}
