#include <bits/stdc++.h>
using namespace std;
int n, len, cnt;
map<string, int> mp;
string ho, st;
int main() {
  cin >> n;
  cin >> ho;
  for (int i = 1; i <= n; i++) {
    cin >> st;
    len = st.length();
    mp[st.substr(0, 3)]++;
    mp[st.substr(5, 3)]++;
    if (mp[st.substr(0, 3)] % 2)
      cnt++;
    else
      cnt--;
    if (mp[st.substr(5, 3)] % 2)
      cnt++;
    else
      cnt--;
  }
  if (cnt == 0)
    cout << "home" << endl;
  else
    cout << "contest" << endl;
  return 0;
}
