#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int i, ans = 0;
  string home;
  cin >> home;
  string s;
  while (n--) {
    cin >> s;
    if (s.substr(0, 3) == home) {
      ans++;
    } else if (s.substr(5, 3) == home) {
      ans--;
    }
  }
  cout << ((ans) ? "contest" : "home");
  return 0;
}
