#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long inf = 1e17;
const int MAXM = 1e5 + 6;
const int MAXN = 10 + 4;
int a[MAXM];
map<string, int> m1, m2;
int main() {
  int n, i, j, k;
  cin >> n;
  string s1[102], s2, s;
  cin >> s;
  for (i = 1; i <= n; i++) {
    cin >> s1[i];
    string sp = s1[i].substr(0, 3);
    string sq = s1[i].substr(5);
    m1[sq]++;
    m2[sq]++;
  }
  if (m1[s] == n / 2 and m2[s] == n / 2 and !(n & 1)) {
    cout << "home\n";
  } else {
    cout << "contest\n";
  }
  return 0;
}
