#include <bits/stdc++.h>
using namespace std;
int main() {
  char home[10];
  int n;
  scanf("%d%s", &n, home);
  int outDeg = 0, inDeg = 0;
  for (int i = 0; i < n; ++i) {
    char line[10];
    scanf("%s", line);
    if (!strncmp(line, home, 3)) {
      outDeg++;
    } else {
      inDeg++;
    }
  }
  assert(outDeg >= inDeg);
  printf("%s\n", outDeg > inDeg ? "contest" : "home");
  return 0;
}
