#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int maxxum = 100;
const int maxint = 999999;
int k;
int cas = 0;
int ans;
int main() {
  int T;
  int i, j;
  int tt;
  int n, m;
  map<string, int> p;
  char c;
  string s;
  scanf("%d", &n);
  cin >> s;
  getchar();
  while (n--) {
    string s1, s2;
    for (i = 0; i < 3; i++) {
      scanf("%c", &c);
      s1 += c;
    }
    getchar();
    getchar();
    for (i = 0; i < 3; i++) {
      scanf("%c", &c);
      s2 += c;
    }
    p[s1]++;
    p[s2]++;
    getchar();
  }
  if (p[s] % 2 == 0)
    puts("home");
  else
    puts("contest");
  return 0;
}
