#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2, s3, s4, now;
  int n, num1 = 0, num2 = 0;
  scanf("%d", &n);
  cin >> s1;
  while (n--) {
    cin >> s2;
    s3 = s2.substr(0, 3);
    s4 = s2.substr(5, 3);
    s1 == s3 ? num1++ : num2++;
  }
  if (num1 == num2)
    printf("home\n");
  else
    printf("contest\n");
}
