#include <bits/stdc++.h>   using namespace std;   map<string, int> m;   int main() {     int n;     cin >> n;     string h;     cin >> h;     m[h]++;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       string a =   , b =   ;       for (int i = 0; i < 3; i++) a += s[i];       for (int i = 5; i < 8; i++) b += s[i];       m[a]++;       m[b]++;     }     cout << (m[h] % 2 ?  home  :  contest ) << endl;   }   