#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
map<string, int> p, q;
int main() {
  int t;
  scanf("%d", &t);
  string s;
  cin >> s;
  q.clear();
  p.clear();
  while (t--) {
    string a, b, c;
    a = "";
    b = "";
    cin >> c;
    int i, j;
    for (i = 0; c[i] != '-'; i++) a += c[i];
    for (j = i + 2; j < c.length(); j++) b += c[j];
    p[a]++;
    q[b]++;
  }
  string s1;
  int flag = 0;
  map<string, int>::iterator it;
  for (it = p.begin(); it != p.end(); it++) {
    string a = it->first;
    if (q[a] != p[a]) {
      flag = 1;
      s1 = a;
      break;
    }
  }
  if (flag)
    cout << "contest" << endl;
  else
    cout << "home" << endl;
}
