There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name "snookah")! When a competition takes place somewhere far from their hometown, Ivan, Artsem and Konstantin take a flight to the contest and back.

Jinotega's best friends, team Base have found a list of their itinerary receipts with information about departure and arrival airports. Now they wonder, where is Jinotega now: at home or at some competition far away? They know that:   this list contains all Jinotega's flights in this year (in arbitrary order),  Jinotega has only flown from his hometown to a snooker contest and back,  after each competition Jinotega flies back home (though they may attend a competition in one place several times),  and finally, at the beginning of the year Jinotega was at home. 

Please help them to determine Jinotega's location!


-----Input-----

In the first line of input there is a single integer n: the number of Jinotega's flights (1 ≤ n ≤ 100). In the second line there is a string of 3 capital Latin letters: the name of Jinotega's home airport. In the next n lines there is flight information, one flight per line, in form "XXX->YYY", where "XXX" is the name of departure airport "YYY" is the name of arrival airport. Exactly one of these airports is Jinotega's home airport.

It is guaranteed that flights information is consistent with the knowledge of Jinotega's friends, which is described in the main part of the statement.


-----Output-----

If Jinotega is now at home, print "home" (without quotes), otherwise print "contest".


-----Examples-----
Input
4
SVO
SVO->CDG
LHR->SVO
SVO->LHR
CDG->SVO

Output
home

Input
3
SVO
SVO->HKT
HKT->SVO
SVO->RAP

Output
contest



-----Note-----

In the first sample Jinotega might first fly from SVO to CDG and back, and then from SVO to LHR and back, so now they should be at home. In the second sample Jinotega must now be at RAP because a flight from RAP back to SVO is not on the list.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation


Solutions:
n = int(input())
s = input()
l = [input().split('->') for i in range(n)]
if n % 2 == 0:
	print('home')
else:
	print('contest')


a = int(input())
if a % 2:
	print('contest')
else:
	print('home')


n = int(input())
a = input()
c = 0
for i in range(n):
	b = input()
	if a in b:
		c += 1
if c % 2 == 0:
	print('home')
else:
	print('contest')


from sys import stdin, stdout

def ri():
	return map(int, stdin.readline().split())
n = int(input())
for i in range(n + 1):
	s = input()
if n % 2:
	print('contest')
else:
	print('home')


n = int(input())
s = input()
(x, y) = (0, 0)
for i in range(n):
	w = input()
	a = w[:3]
	if a == s:
		x += 1
	else:
		y += 1
if x == y:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
f = {}
for i in range(n):
	l = list(input().split('->'))
	if l[0] in f:
		f[l[0]] += 1
	else:
		f[l[0]] = 1
	if l[1] in f:
		f[l[1]] += 1
	else:
		f[l[1]] = 1
ans = 'home'
for i in f:
	if f[i] % 2 == 1 and i != home:
		ans = 'contest'
		break
print(ans)


n = int(input())
home = str(input())
away = 0
into = 0
for i in range(n):
	flight = input().split('->')
	if flight[0] == home:
		away += 1
	else:
		into += 1
if away > into:
	print('contest')
else:
	print('home')


import math
n = int(input())
m = input()
a = []
for i in range(n):
	(k, l) = map(str, input().split('->'))
	a.append(l)
if a.count(m) == math.ceil(n / 2):
	print('home')
else:
	print('contest')


n = int(input())
home = input()
for _ in range(n):
	str = input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
x = []
y = []
for i in range(n):
	(a, b) = map(str, input().split('->'))
	x.append(a)
	y.append(b)
k = x.count(s)
m = y.count(s)
if k == m:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
flights = []
while n > 0:
	(s, t) = input().split('->')
	flights.append(s)
	flights.append(t)
	n -= 1
count = 0
for flight in flights:
	if flight == home:
		count += 1
if count % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input()) % 2
print('contest' if n else 'home')


n = int(input())
s = input()
for i in range(n):
	tmp = input()
print('home') if n & 1 == 0 else print('contest')


x = int(input())
y = input()
p = list()
k = list()
for i in range(x):
	a = input()
	p.append(a[5:])
	k.append(a[0:3])
if p.count(y) >= k.count(y):
	print('home')
else:
	print('contest')


n = int(input().strip())
l = 0
k = input().strip()
for i in range(n):
	j = input().strip()
	if '->' + k in j:
		l += 1
	else:
		l -= 1
if l == 0:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
tl = [input() for _ in range(n)]
print('home' if n % 2 == 0 else 'contest')


f = lambda : map(int, input().split())
n = int(input())
d = r = 0
h = input()
for i in range(n):
	s = input()
	if s.find(h) == 0:
		d += 1
	if s.find(h) == 5:
		r += 1
print(['home', 'contest'][d != r])


x = int(input())
h = input()
c = 0
for i in range(x):
	n = input()
	if n[0] + n[1] + n[2] == h:
		c += 1
	else:
		c -= 1
if c == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
ans = 'contest'
flights = []
for i in range(n):
	s = input()
	sou = s[0:3]
	to = s[-3:]
	flight = (sou, to)
	rev = (to, sou)
	if rev in flights:
		flights.remove(rev)
	else:
		flights.append(flight)
if len(flights) == 0:
	ans = 'home'
print(ans)


n = int(input())
home = input()
flights = []
comesFrom = []
goesTo = []
for i in range(n):
	flights.append(input())
	(goingFrom, comingTo) = flights[i].split('->', 1)
	if goingFrom == home:
		goesTo.append(comingTo)
	if comingTo == home:
		comesFrom.append(goingFrom)
if len(comesFrom) == len(goesTo):
	print('home')
else:
	print('contest')


n = int(input())
st = str(input())
l = [input().split('->') for i in range(n)]
l1 = list((l[i][0] for i in range(len(l))))
l2 = list((l[i][1] for i in range(len(l))))
ll = list(l1 + l2)
c = 0
for i in ll:
	if st == i:
		c += 1
if c == n and c % 2 == 0:
	print('home')
else:
	print('contest')


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

def output(answer):
	stdout.write(str(answer))
n = int(z())
home = z()
(s1, s2) = (0, 0)
for i in range(n):
	(a, b) = z().split('->')
	if a == home:
		s1 += 1
	else:
		s2 += 1
print('home' if s1 == s2 else 'contest')


n = int(input())
hm = input()
for i in range(n):
	fix = input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


from collections import Counter
n = int(input())
air = input()
flights = Counter()
for i in range(n):
	(a, b) = input().split('->')
	if a == air:
		flights[b] += 1
	else:
		flights[a] += 1
for c in flights:
	if flights[c] % 2:
		print('contest')
		exit(0)
print('home')


import re
import math
num = int(input())
input()
for i in range(num):
	input()
if num % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
ss = []
cnt = 0
for i in range(n):
	t = input()
	t = t.split('->')
	cnt += t[1] == s
	ss.append(t)
if cnt == n // 2 and n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
for i in range(n):
	m = input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


no_flights = int(input())
home = input()
flights = [input().split('- >') for i in range(no_flights)]
if no_flights % 2 == 0:
	print('home')
else:
	print('contest')


print('contest' if int(input()) & 1 else 'home')


number = int(input())
home = input()
flights = []
for i in range(number):
	flights.append(input().split('->'))
dep = home
while flights != []:
	found = 0
	for j in flights:
		if j[0] == dep:
			dep = j[1]
			found = 1
			flights.remove(j)
			break
	if found == 0:
		break
if dep == home:
	print('home')
else:
	print('contest')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
s = get_string()
for i in range(n):
	get_string()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
t = n
home = input()
departure = []
while t > 0:
	flight = input()
	departure.append(flight[:3])
	t -= 1
if n % 2 == 0:
	print('home')
else:
	print('contest')


t = int(input())
s = input()
for _ in range(t):
	input()
print('home' if t % 2 == 0 else 'contest')


n = int(input())
text = input()
k = 0
for x in range(n):
	text1 = input()
	if text1[0:3] == text:
		k = k + 1
	else:
		k = k - 1
if k == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
aux = 0
while n > 0:
	(ida, volta) = input().split('->')
	if ida == home:
		aux += 1
	elif volta == home:
		aux -= 1
	n -= 1
if aux != 0:
	print('contest')
else:
	print('home')


import sys
n = int(sys.stdin.readline())
home = sys.stdin.readline().strip()
for line in sys.stdin:
	des = line.split('->')[1].strip()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
a = str(input())
for i in range(n):
	(c, b) = map(str, input().split('->'))
if n % 2 == 0:
	print('home')
else:
	print('contest')


a = int(input())
input()
for i in range(a):
	input()
if a % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
(one, two) = (0, 0)
for i in range(n):
	x = list(input().split('->'))
	if x[0] == home:
		one += 1
	elif x[1] == home:
		two += 1
if one == two:
	print('home')
else:
	print('contest')


n = int(input())
start = input()
ret = 0
go = 0
for i in range(n):
	s = input().split('->')
	if s[0] == start:
		go += 1
	elif s[1] == start:
		ret += 1
if ret >= go:
	print('home')
else:
	print('contest')


c = int(input())
s = str(input())
t = ''
for i in range(c):
	t = t + str(input())
x = t.count(s)
if x % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
f = []
c = 0
for i in range(n):
	f.append(input().split('->'))
for i in range(n):
	c += f[i].count(h)
if c % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
input()
for x in range(n):
	input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


def main():
	print(('home', 'contest')[int(input()) & 1])
main()


n = int(input())
l = list(input())
z = []
for i in range(n):
	(x, y) = map(str, input().split('->'))
	z.append(x)
	z.append(y)
z1 = list(set(z))
z2 = []
for i in range(len(z1)):
	z2.append(z.count(z1[i]))
for i in range(len(z2)):
	if z2[i] % 2 == 1:
		print('contest')
		break
else:
	print('home')


n = int(input())
s = input()
(z, count) = ([], 0)
for _ in range(n):
	z.append(input().strip().split('->'))
for x in range(n):
	if z[x][0] == s or z[x][1] == s:
		count += 1
if count % 2 == 0:
	print('home')
else:
	print('contest')


def main():
	n_flights = int(input())
	home = input()
	flights_from_home = {}
	flights_to_home = {}
	for _ in range(n_flights):
		[depart, destination] = input().split('->')
		if depart == home:
			flights_from_home[destination] = flights_from_home.get(destination, 0) + 1
		else:
			flights_to_home[depart] = flights_to_home.get(depart, 0) + 1
	away = False
	for (destination, times) in flights_from_home.items():
		if destination not in flights_to_home or flights_to_home.get(destination) < times:
			away = True
			break
	print('contest' if away else 'home')
main()


n = int(input())
city = input()
cout = 0
for i in range(n):
	a = input()
	if city in a:
		cout += 1
if cout % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
cur = 0
for i in range(n):
	ticket = input()
	if home == ticket[:3]:
		cur += 1
if n - cur >= cur:
	print('home')
else:
	print('contest')


t = int(input())
if t % 2 == 0:
	print('home')
else:
	print('contest')


num = eval(input())
if num % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
flights = []
for i in range(n):
	flights.append(input())
if n % 2 == 0:
	print('home')
else:
	print('contest')


import sys

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None

def solve():
	n = int(input())
	if n % 2 == 0:
		ans = 'home'
	else:
		ans = 'contest'
	print(ans)
solve()


n = int(input())
if n % 2 == 0:
	print('home')
	exit()
else:
	print('contest')
	exit()


F = int(input())
if F % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home_airport = input()
itinerary = [input() for i in range(n)]
print('home') if n % 2 == 0 else print('contest')


3
n = int(input())
if n % 2 == 0:
	print('home')
else:
	print('contest')


t = int(input())
if t % 2 == 1:
	print('contest')
else:
	print('home')


t = int(input())
a = input()
bal = 0
for _ in range(t):
	b = input().split('->')
	if b[0] == a:
		bal += 1
	if b[1] == a:
		bal -= 1
if bal == 0:
	print('home')
else:
	print('contest')


a = int(input())
for x in range(a + 1):
	_n = input()
if a % 2:
	print('contest')
else:
	print('home')


from collections import Counter

def solve(n, home, d):
	d = Counter(d)
	return 'contest' if d[home] % 2 == 1 else 'home'

def main():
	n = int(input())
	home = input()
	d = []
	for i in range(n):
		(a, b) = input().split('->')
		d.append(a)
		d.append(b)
	print(solve(n, home, d))
main()


n = int(input())
s = input()
go = 0
out = 0
for i in range(n):
	ss = input()
	if ss[:3] == s:
		go += 1
	if ss[-3:] == s:
		out += 1
if out == go:
	print('home')
else:
	print('contest')


import sys
n = int(sys.stdin.readline().strip())
home = sys.stdin.readline().strip()
counter1 = 0
counter2 = 0
for i in range(n):
	string = sys.stdin.readline().strip().split('->')
	(start, dest) = string
	if dest == home:
		counter1 += 1
	if start == home:
		counter2 += 1
if counter1 == counter2:
	print('home')
else:
	print('contest')


t = int(input())
home = input()
outbound = 0
inbound = 0
for x in range(t):
	l1 = input().split('->')
	if l1[0] == home:
		outbound += 1
	else:
		inbound += 1
if inbound == outbound:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
t = [0, 0]
for i in range(n):
	a = input().split('->')
	if a[0] == home:
		t[0] += 1
	elif a[1] == home:
		t[1] += 1
if bool(abs(t[1] - t[0]) & 1):
	print('contest')
else:
	print('home')


import sys
n = int(sys.stdin.readline())
i = 0
home = sys.stdin.readline().strip()
A = {}
while i < n:
	st = sys.stdin.readline().split('->')
	if st[0] in A.keys():
		A[st[0]].append(st[1][:-1])
	else:
		A[st[0]] = [st[1][:-1]]
	i += 1
B = {}
for i in A.keys():
	B[i] = 0
i = home
f = 0
while True:
	try:
		if B[i] >= len(A[i]):
			for j in A.keys():
				if B[i] < len(A[j]):
					i = j
					f = 1
					break
			if f == 0:
				break
		x = A[i][B[i]]
		B[i] += 1
		i = x
	except:
		if i == home:
			i = home + '1'
		break
if i == home:
	print('home')
else:
	print('contest')


n = int(input())
b = input()
x1 = []
x2 = []
result = 0
for i in range(0, n):
	text = input()
	x1.append(text.split('->')[0])
	x2.append(text.split('->')[1])
x1.sort()
x2.sort()
if x1 == x2:
	print('home')
else:
	print('contest')


a = int(input())
home = input()
(l, first, second) = ([], [], [])
for _ in range(a):
	l.append(input())
for i in range(len(l)):
	first.append(l[i][:3])
	second.append(l[i][5:])
first.sort()
second.sort()
if first == second:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
c = 0
for i in range(n):
	l = input().split('->')
	if l[0] != home:
		c += 1
if c == 0 or n % (c * 2):
	print('contest')
else:
	print('home')


import sys, math
from collections import deque

def solve():
	return
n = int(input())
h = input()
cnt = 0
for i in range(n):
	s = input()
	if h == s[:3] or h == s[-3:]:
		cnt += 1
if cnt % 2 == 0:
	print('home')
else:
	print('contest')


from collections import defaultdict
n = int(input())
input()
d = defaultdict(int)
for _ in range(n):
	(x, y) = input().split('->')
	d[x] += 1
	d[y] -= 1
print('home' if all((value == 0 for value in d.values())) else 'contest')


n = int(input())
for i in range(n + 1):
	input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
cnt = 0
for i in range(n):
	x = input().split('->')
	cnt += x.count(home)
a = ['home', 'contest']
print(a[cnt % 2])


print('hcoomnet e s t'[int(input()) % 2::2])


n = int(input())
home = input()
(l, status) = ([], 'home')
while n:
	n -= 1
	(x, y) = [x for x in input().split('->')]
	l.append(x + '->' + y)
	if x + '->' + y in l and y + '->' + x in l:
		status = 'home'
		(i1, i2) = (l.index(x + '->' + y), l.index(y + '->' + x))
		(l[i1], l[i2]) = ('---', '---')
	else:
		status = 'contest'
l = list(set(l))
if len(l) > 1:
	print('contest')
else:
	print(status)


(k, a) = (int(input()), input())
(c, d) = (0, 0)
for i in range(k):
	s = input()
	b = s.split('->')
	if b[0] == a:
		c += 1
	elif b[1] == a:
		d += 1
if c == d:
	print('home')
else:
	print('contest')


import sys

def main():
	n = int(input())
	home = input().strip()
	(cnt_fr, cnt_to) = (0, 0)
	for i in range(n):
		(fr, to) = input().strip().split('->')
		if fr == home:
			cnt_fr += 1
		if to == home:
			cnt_to += 1
	if cnt_fr == cnt_to + 1:
		print('contest')
	elif cnt_fr == cnt_to:
		print('home')
	else:
		sys.exit(1)
main()


n = int(input())
h = input()
d = 0
for i in range(n):
	a = input().split('->')
	if a[0] == h:
		d += 1
	if a[1] == h:
		d -= 1
if d:
	print('contest')
else:
	print('home')


n = int(input())
a = input()
s = []
m = dict()
for i in range(n):
	d = input()
	d = d.split('->')
	if m.get(d[0]) == None:
		m[d[0]] = []
	m[d[0]].append(d[1])
b = a
while True:
	if m.get(b) == None or m[b] == []:
		break
	tmp = m[b][0]
	del m[b][0]
	b = tmp
if b == a:
	print('home')
else:
	print('contest')


n = int(input())
l = []
s = input()
(x, y) = ([], [])
for i in range(n):
	(xx, yy) = input().split('->')
	x.append(xx)
	y.append(yy)
if s in x and s in y:
	if x.count(s) == y.count(s):
		print('home')
	else:
		print('contest')
else:
	print('contest')


N = int(input())
home = input()
ans = 0
for i in range(N):
	ans += 1 if str(input()).split('->')[0] == home else -1
print('home' if ans == 0 else 'contest')


n = int(input())
a = str(input())
h = 0
c = 0
for i in range(n):
	x = str(input())
	if a == x[:3]:
		h = h + 1
	if a == x[5:]:
		c = c + 1
if h > c:
	print('contest')
else:
	print('home')


print('home' if int(input()) % 2 is 0 else 'contest')


print(('home', 'contest')[int(input()) % 2])


n = int(input())
airp = input()
dep = []
arr = []
for i in range(n):
	t = input().split('->')
	dep.append(t[0])
	arr.append(t[1])
if n % 2 == 1:
	print('contest')
elif dep.count(airp) == arr.count(airp):
	print('home')
else:
	print('contest')


n = int(input())
gorod = input()
k = 0
for i in range(n):
	polet = input()
	k = k + 1
if k % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
d = dict()
for x in range(0, n):
	j = input()
	jj = j.split('->')
	k = jj[1] + '->' + jj[0]
	if k in d.keys():
		d[k] -= 1
	elif j in d.keys():
		d[j] += 1
	else:
		d[j] = 1
e = list(filter(lambda x: x != 0, d.values()))
print('home' if len(e) == 0 else 'contest')


number = int(input())
cplace = input()
total = []
for i in range(number):
	(x, y) = input().split('->')
	total.append(x)
	total.append(y)
b = True
for e in total:
	if total.count(e) % 2 == 1:
		b = False
if b:
	print('home')
else:
	print('contest')


x = int(input())
a = input()
if x % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
flights = []
for i in range(n):
	inp = input()
	f = inp.split('->')
	new = []
	new.append(f[0])
	new.append(f[1])
	new.append(True)
	flights.append(new)
contest = False
if n % 2 == 1:
	contest = True
else:
	found = False
	for f in flights:
		if f[0] == home:
			found = True
			break
	if found == True:
		cap = len(flights)
		for i in range(cap):
			if flights[i][2] == True:
				found = False
				dest = flights[i][1]
				arr = flights[i][0]
				for j in range(cap):
					if flights[j][0] == dest and flights[j][2] == True and (flights[j][1] == arr):
						flights[j][2] = False
						flights[i][2] = False
						found = True
						break
				if found == False:
					contest = True
					break
if contest == True:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
L = []
for i in range(n):
	L.append(input())
if n % 2 != 0:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
src = []
dest = []
for i in range(n):
	x = input().split('->')
	src.append(x[0])
	dest.append(x[1])
cs = src.count(home)
cd = dest.count(home)
if cs > cd:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
rex = 0
while n:
	n -= 1
	(a, b) = input().split('->')
	if a == home:
		rex += 1
	if b == home:
		rex += 1
print('contest' if rex % 2 else 'home')


def main_function():
	n = int(input())
	home = input()
	flights = [input() for i in range(n)]
	if not n % 2:
		return 'home'
	return 'contest'
print(main_function())


num = eval(input())
home = input()
startPlace = []
arrivePlace = []
for i in range(num):
	line = list(input())
	startPlace.append(''.join(line[0:3]))
	arrivePlace.append(''.join(line[5:9]))
a = startPlace.count(home)
b = arrivePlace.count(home)
if a == b:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
fl = ''
x = 0
for i in range(n):
	fl = input()
	if fl[-3:] == home:
		x += 1
if x == n / 2:
	print('home')
else:
	print('contest')


n = int(input())
code = input()
lines = []
for i in range(n):
	lines.append(input())
went = 0
came = 0
for line in lines:
	if line.startswith(code):
		went += 1
	else:
		came += 1
if went > came:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
flights = {}
for x in range(n):
	flight = input()
	places = flight.split('->')
	a = places[0]
	b = places[1]
	if not a in flights:
		flights[a] = []
	flights[a].append(b)
place = home
while place in flights:
	if len(flights[place]) == 0:
		break
	temp = flights[place][0]
	del flights[place][0]
	place = temp
if place == home:
	print('home')
else:
	print('contest')


import sys
n = int(input())
k = 0
s = input()
if n == 1:
	print('contest')
	sys.exit()
for i in range(n):
	s1 = input()
	if s1.startswith('{}->'.format(s)):
		k += 1
if n % k == 0:
	print('home')
else:
	print('contest')


n = int(input())
a = input()
b = [''] * n
for i in range(n):
	b[i] += input()
for i in range(n):
	c = b[i][0:3]
	d = b[i][5:8]
	for j in range(n):
		if b[j][0:3] == d and b[j][5:8] == c:
			b[j] = ''
			b[i] = ''
			break
		elif j == n - 1 and b[i] != '':
			if c == a:
				print('contest')
				exit(0)
print('home')


n = int(input())
home = input().strip()
flightsFromHome = []
flightsToHome = []
for i in range(n):
	pair = input().strip().split('->')
	if pair[0] == home:
		flightsFromHome.append(pair[0])
	else:
		flightsToHome.append(pair[1])
while len(flightsToHome) and len(flightsFromHome):
	a = flightsToHome.pop()
	if a in flightsFromHome:
		flightsFromHome.remove(a)
if not len(flightsToHome) and (not len(flightsFromHome)):
	print('home')
else:
	print('contest')


n = int(input())
places = set()
start = input()
places.add(start)
for i in range(n):
	for s in input().split('->'):
		if s in places:
			places.remove(s)
		else:
			places.add(s)
for place in places:
	if place == start:
		print('home')
	else:
		print('contest')


print('choonmtee s t'[1 - int(input()) % 2::2])


n = int(input())
a = {0: 'home', 1: 'contest'}
print(a[n % 2])


import sys
import math
import bisect
import itertools

def main():
	n = int(input())
	home = input()
	nout = 0
	nin = 0
	for i in range(n):
		s = input()
		src = s[0:3]
		dst = s[5:8]
		if src == home:
			nout += 1
		if dst == home:
			nin += 1
	if nout == nin:
		print('home')
	elif nout == nin + 1:
		print('contest')
main()


n = int(input())
s = input()
d = dict()
for i in range(n):
	s1 = input()
	s2 = s1[0:3]
	s3 = s1[5:]
	if s2 in d:
		d[s2] += 1
	else:
		d[s2] = 1
	if s3 in d:
		d[s3] += 1
	else:
		d[s3] = 1
flag = False
for i in d:
	if d[i] % 2 != 0 and i != s:
		print('contest')
		flag = True
		break
if not flag:
	print('home')


n = int(input())
home = input()
left_home = got_home = 0
for _ in range(n):
	s = input()
	if s[:len(home)] == home:
		left_home += 1
	if s[-len(home):] == home:
		got_home += 1
if left_home == got_home:
	print('home')
else:
	print('contest')


from collections import defaultdict
n = int(input())
h = str(input())
d = defaultdict(int)
for i in range(n):
	(arr, dep) = input().split('->')
	d[arr] = d[arr] - 1
	d[dep] = d[dep] + 1
if d[h] == 0:
	print('home')
else:
	print('contest')


import sys
from itertools import *
from cmath import *
from math import *

def inp():
	return int(input().strip())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def iss(s):
	t = s[::-1]
	return t == s
n = inp()
home = str(input())
curr = home
flight = []
for _ in range(n):
	s = str(input())
	flight.append(s)
arr = []
for i in range(n):
	tmp = flight[i][5:] + '->' + flight[i][:3]
	if tmp not in arr:
		arr.append(flight[i])
	else:
		arr.remove(tmp)
print('home' if len(arr) == 0 else 'contest')


n = int(input())
h = input()
l = []
v = 0
p = 0
for i in range(n):
	(vc, pc) = input().split('->')
	if vc == h:
		v += 1
	elif pc == h:
		p += 1
if v == p:
	print('home')
else:
	print('contest')


t = int(input())
s = input()
cnt1 = 0
cnt2 = 0
for i in range(t):
	s1 = input()
	p1 = s1[:3]
	p2 = s1[5:]
	if p1 == s:
		cnt1 = cnt1 + 1
	else:
		cnt2 = cnt2 + 1
if cnt1 == cnt2:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
i = 0
lst = []
while i < n:
	lst.append(input())
	i += 1
j = cnt = cnt1 = 0
while j < len(lst):
	if lst[j][:3] == home:
		cnt += 1
	if lst[j][-3:] == home:
		cnt1 += 1
	j += 1
if cnt == cnt1:
	print('home')
else:
	print('contest')


__author__ = 'Ryabchun Vladimir'
flights = int(input())
home = input().strip()
for _ in range(flights):
	fl = input()
if flights % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
count = 0
while n > 0:
	(a, b) = map(str, input().split('->'))
	if a == home or b == home:
		count += 1
	n -= 1
print('contest') if count % 2 != 0 else print('home')


n = int(input())
h = input()
m = {}
for i in range(n):
	(s, e) = input().split('->')
	if s not in m:
		m[s] = [e]
	else:
		m[s] += [e]
curD = h
while curD in m:
	pre = curD
	curD = m[curD][-1]
	m[pre].pop()
	if m[pre] == []:
		del m[pre]
if curD != h:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
f = []
s = []
for _ in range(n):
	line = input()
	f.append(line[:3])
	s.append(line[5:])
if f.count(home) == s.count(home):
	print('home')
else:
	print('contest')


amountFly = int(input())
homePort = input()
aout = 0
ain = 0
for i in range(amountFly):
	Fly = input()
	if Fly[:3] == homePort:
		aout += 1
	if Fly[5:] == homePort:
		ain += 1
if aout == ain:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
cnt = 0
for _ in range(n):
	line = input()
	if line.startswith(home):
		cnt += 1
	elif line.endswith(home):
		cnt -= 1
if cnt == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
k = 0
for i in range(n):
	temp = input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
go = re = 0
for i in range(n):
	(a, b) = input().split('->')
	if a == s:
		go += 1
	elif b == s:
		re += 1
if go == re:
	print('home')
else:
	print('contest')


t = int(input())
a = input()
J = []
H = []
for i in range(t):
	(n, m) = input().split('->')
	J.append(m)
	H.append(n)
c = J[-1]
l = H[0]
d = t % 2
if d == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
place = {}
for _ in range(n):
	s = input()
	if s[0:3] not in place:
		place[s[0:3]] = 1
	else:
		place[s[0:3]] += 1
	if s[5:8] not in place:
		place[s[5:8]] = 1
	else:
		place[s[5:8]] += 1
if place[home] % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
went_to = []
back_from = []
for _ in range(n):
	(depart, arrive) = input().split('->')
	if arrive == home:
		back_from.append(depart)
	if depart == home:
		went_to.append(arrive)
contest = False
while len(went_to) > 0:
	if went_to[-1] in back_from:
		back_from.remove(went_to[-1])
		del went_to[-1]
	else:
		contest = True
		break
if contest:
	print('contest')
else:
	print('home')


def main():
	n = int(input())
	print('home' if not n % 2 else 'contest')
main()


n = int(input())
home = str(input())
airports = []
left = 0
right = 0
for i in range(n):
	flight = []
	flight = input().split('->')
	airports.append(flight)
	if flight[0] == home:
		left += 1
	if flight[1] == home:
		right = right + 1
if left == right:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
for i in range(n - 1):
	s = input()
s1 = input().split('->')
if n % 2 == 0:
	print('home')
else:
	print('contest')


import sys
read = lambda : sys.stdin.readline().strip()
write = lambda x: sys.stdout.write(x + '\n')
N = int(read())
home = read()
itin = {}
flights = {}
for _ in range(N):
	inp = read()
	(a, b) = inp.split('->')
	if inp in itin.keys():
		itin[inp] += 1
	else:
		itin.update({inp: 1})
	if a in flights.keys():
		flights[a].add(b)
	else:
		tmp = set()
		tmp.add(b)
		flights.update({a: tmp})
table = {i: 0 for i in itin.keys()}
itinerary = table.keys()
s = [home]
while s:
	cur = s.pop()
	ncity = None
	if cur not in flights.keys():
		break
	for nxt in flights[cur]:
		f = cur + '->' + nxt
		if f in itinerary and table[f] < itin[f]:
			table[f] += 1
			ncity = nxt
			break
	if not ncity:
		break
	s.extend([cur, nxt])
if cur == home:
	write('home')
else:
	write('contest')


n = int(input())
home = input()
l = []
for i in range(n):
	(a, b) = input().split('->')
	l.append([a, b])
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
c = 0
for i in range(0, n):
	travel = input()
	frm = travel.split('->')[0]
	to = travel.split('->')[1]
	if frm == home or to == home:
		c += 1
if c % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
a = []
for i in range(n):
	s = input()
	a.append(s[:3])
	a.append(s[5:])
print('contest') if a.count(home) % 2 != 0 else print('home')


N = int(input())
S = input()
L = []
count = 0
for i in range(N):
	L.append(input().split('->'))
	if L[i][0] == S or L[i][1] == S:
		count += 1
if count % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
cnt = 0
for i in range(n):
	s = input()
	s.split('->')
	cnt += s.count(home)
if cnt % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
(cnt1, cnt2) = (0, 0)
for i in range(n):
	t = input()
	if s == t[:3]:
		cnt1 += 1
	elif s == t[5:8]:
		cnt2 += 1
print('home' if cnt1 == cnt2 else 'contest')


alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
h = str(input())
p = 0
for i in range(n):
	s = str(input())
	if s[0:3] == h:
		p += 1
	else:
		p -= 1
if p > 0:
	print('contest')
else:
	print('home')


import sys
n = int(input())
home = input()
flights = {}
for i in range(n):
	flight = input()
	index = (flight[0:3], flight[5:8])
	if index not in flights:
		flights[index] = 0
	else:
		flights[index] += 1
for flight in flights.keys():
	flight_re = (flight[1], flight[0])
	if flight_re in flights:
		if flights[flight_re] != flights[flight]:
			print('contest')
			sys.exit(0)
	else:
		print('contest')
		sys.exit(0)
print('home')


n = int(input())
s = input()
c = 0
for i in range(n):
	mass = input()
	mass = mass.split('->')
	if s in mass:
		c += 1
if not c % 2:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
for _ in range(n):
	s = input
print('contest' if n % 2 else 'home')


import sys
dict = {}
n = int(input())
home = input()
for i in range(n):
	line = input()
	dep = line[0:3]
	if dep != home:
		if dep in dict:
			dict[dep] -= 1
		else:
			dict[dep] = -1
	else:
		dep = line[5:]
		if dep in dict:
			dict[dep] += 1
		else:
			dict[dep] = 1
for key in dict:
	if dict[key] > 0:
		print('contest')
		sys.exit()
print('home')


n = int(input())
for _ in range(n + 1):
	l = list(input())
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home_airport = input()
flights = []
while n > 0:
	n -= 1
	(_from, _to) = input().split('->')
	flights.append(_from)
	flights.append(_to)
count = 0
for i in range(len(flights)):
	if flights[i] == home_airport:
		count += 1
if count % 2:
	print('contest')
else:
	print('home')


a = []
n = int(input())
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home_airport = input()
g = {}
for i in range(0, n):
	x = input()
	s = x.split('->')
	src = s[0]
	dest = s[1]
	if src in g:
		if dest in g[src]:
			g[src][dest] = g[src][dest] + 1
		else:
			g[src][dest] = 1
	else:
		g[src] = {dest: 1}
for dest in g[home_airport]:
	if dest not in g:
		print('contest')
		exit(0)
	if home_airport not in g[dest]:
		print('contest')
		exit(0)
	elif g[home_airport][dest] != g[dest][home_airport]:
		print('contest')
		exit(0)
print('home')


n = int(input())
s = input()
d = {}
d[s] = 0
for _ in range(n):
	(x, y) = input().split('->')
	if x == s:
		d[s] -= 1
	elif y == s:
		d[s] += 1
print('home' if d[s] == 0 else 'contest')


(N, home) = (int(input()), input())
print('home' if [item for middle in [input().split('->') for i in range(N)] for item in middle].count(home) % 2 == 0 else 'contest')


X = int(input())
Home = input()
counter = 0
for i in range(X):
	(h, c) = list(input().split('->'))
	if h == Home:
		counter += 1
	elif c == Home:
		counter -= 1
print('home' if counter == 0 else 'contest')


n = int(input())
home = input()
flights = []
for i in range(n):
	(f, t) = input().split('->')
	if (t, f) in flights:
		flights.remove((t, f))
	else:
		flights.append((f, t))
print('home' if len(flights) == 0 else 'contest')


import re
n = int(input())
home = input()
cv = home
l = []
for x in range(n):
	l.extend(input().split('->'))
for x in range(n):
	for x in range(0, 2 * n - 1, 2):
		if re.match(cv, l[x]):
			cv = l[x + 1]
			l[x] = '0'
			l[x + 1] = '0'
			break
if re.match(cv, home):
	print('home')
else:
	print('contest')


n = int(input())
home = input()
(inn, out) = ([], [])
for i in range(n):
	t = input().split('->')
	inn.append(t[0])
	out.append(t[1])
if inn.count(home) == out.count(home):
	print('home')
else:
	print('contest')


n = int(input())
home = input()
ls = []
cnt = 0
for i in range(n):
	str1 = input()
	if str1.find(home) >= 0:
		cnt += 1
if cnt == n and cnt % 2 == 0:
	print('home')
else:
	print('contest')


from collections import defaultdict
n = int(input())
home = input()
d = defaultdict(int)
for i in range(n):
	s = input()
	(fr, to) = s.split('->')
	d[fr] -= 1
	d[to] += 1
if d[home] == 0:
	print('home')
else:
	print('contest')


n = int(input())
z = input()
a = ''
for i in range(n):
	c = input()
	a += c
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
(c1, c2) = (0, 0)
for i in range(n):
	(x, y) = input().split('->')
	if x == h:
		c1 = c1 + 1
	elif y == h:
		c2 = c2 + 1
if c1 == c2:
	print('home')
else:
	print('contest')


N = int(input())
home = input()
fromHome = {}
toHome = {}
ans = 1
for i in range(N):
	s = str(input()).split('->')
	if s[0] == home:
		fromHome[s[1]] = fromHome.get(s[1], 0) + 1
	else:
		toHome[s[0]] = toHome.get(s[0], 0) + 1
for (key, value) in fromHome.items():
	if toHome.get(key, 0) < value:
		ans = 0
print('home' if ans else 'contest')


import sys

def main():
	n = int(input())
	cnt = 0
	src = input().strip()
	for i in range(n):
		nodes = input().strip().split('->')
		if nodes[0] == src or nodes[1] == src:
			cnt += 1
	if cnt % 2 == 0:
		print('home')
	else:
		print('contest')
main()


l = []
a = int(input())
if a % 2 == 1:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
berangkat = 0
tujuan = 0
for i in range(n):
	inp = input().split('->')
	if inp[0] == home:
		berangkat += 1
	if inp[1] == home:
		tujuan += 1
if berangkat == tujuan:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
for i in range(n):
	l = input()
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
t = input()
gya = []
aya = []
for k in range(n):
	p = input()
	if p[:3] == t:
		gya.append(p[-3:])
	elif p[-3:] == t:
		aya.append(p[:3])
gya.sort()
aya.sort()
if gya == aya:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
d_count = 0
for i in range(n):
	(d, a) = input().split('->')
	if d == h:
		d_count += 1
	elif a == h:
		d_count -= 1
if d_count == 0:
	ans = 'home'
elif d_count == 1:
	ans = 'contest'
print(ans)


def solve(home, arr):
	for (i, f) in enumerate(arr):
		found = False
		if f[0] == home and (not f[2]):
			for (j, t) in enumerate(arr):
				if t[1] == home and t[0] == f[1] and (not t[2]):
					found = True
					f[2] = True
					t[2] = True
					break
			if not found:
				return 'contest'
	return 'home'

def main():
	n = int(input())
	home = input()
	arr = []
	for i in range(n):
		j = input().split('->')
		j.append(False)
		arr.append(j)
	print(solve(home, arr))
main()


x = int(input())
h = input()
left = {}
right = {}
for i in range(x):
	s = list(input().split('->'))
	if s[0] in left:
		left[s[0]] = left[s[0]] + 1
	else:
		left[s[0]] = 1
	if s[1] in right:
		right[s[1]] = right[s[1]] + 1
	else:
		right[s[1]] = 1
if x == 1:
	print('contest')
elif left[h] > right[h]:
	print('contest')
else:
	print('home')


arr = []
n = int(input())
home = input()
for i in range(n):
	arr.append(input().split('->'))
if sorted([i[0] for i in arr]) == sorted([i[1] for i in arr]):
	print('home')
else:
	print('contest')


n = int(input())
home = input()
count = 0
for _ in range(n):
	s = input()
	count += -1 if s[0:3] == home else 1
print('home' if count == 0 else 'contest')


n = int(input())
h = str(input())
l = []
count = 0
for i in range(n):
	c = str(input())
	l.append(c)
if len(l) % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
k = 0
for i in range(n):
	a = input()
	if home in a[-3:]:
		k += 1
if k == 0:
	print('contest')
elif n / k == 2:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
a = [input() for i in range(n)]
flag = 0
x = 0
while x < len(a):
	p = a[x][-3:] + '->' + a[x][0:3]
	if p in a:
		a.remove(a[x])
		a.remove(p)
	else:
		flag = 1
		break
if flag == 1:
	print('contest')
else:
	print('home')


n = int(input())
hometown = input().strip()
towns_from = set()
towns_to = set()
for i in range(n):
	st = input().split('->')
	while st[0] in towns_from:
		st[0] += '_'
	towns_from.add(st[0])
	while st[1] in towns_to:
		st[1] += '_'
	towns_to.add(st[1])
tanswer = towns_from ^ towns_to
answer = set()
for i in tanswer:
	tmp = i.find('_')
	if i != -1:
		answer.add(i[:tmp])
	else:
		answer.add(i)
if len(answer) == 0:
	print('home')
else:
	print('contest')


n = int(input())
s = input()
l = []
for i in range(n):
	t = input()
	l.append(t[:3])
	l.append(t[5:])
c = l.count(s)
if c % 2 == 0:
	print('home')
else:
	print('contest')


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
n = I()
home = S()
print('contest' if n % 2 else 'home')


a = int(input())
b = input()
s = 0
for i in range(a):
	li = input().split('->')
	if li[0] == b:
		s += 1
	elif li[1] == b:
		s -= 1
if s == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
cnt = 0
for i in range(n):
	a = input().split('->')
	cnt += a[0] == home
	cnt -= a[1] == home
print(('home', 'contest')[cnt])


number_of_flights = int(input())
output = 'contest' if number_of_flights % 2 else 'home'
for _ in range(number_of_flights + 1):
	input()
print(output)


n = int(input())
home = input()
left = right = 0
for i in range(n):
	inp = input().split('->')
	if inp[0] == home:
		left += 1
	elif inp[1] == home:
		right += 1
if left > right:
	print('contest')
else:
	print('home')


n = int(input())
home = input().strip()
l = []
for x in range(n):
	(a, b) = map(str, input().split('->'))
	l.append((a, b))
found = False
while True:
	if len(l) == 0:
		break
	x = l[-1]
	l.pop()
	if (x[1], x[0]) in l:
		l.remove((x[1], x[0]))
	else:
		found = True
if found:
	print('contest')
else:
	print('home')


n = int(input())
home = input()
a = []
for _ in range(n):
	a.append(input().split('->'))
c1 = 0
c2 = 0
for i in a:
	if i[0] == home:
		c1 += 1
	elif i[1] == home:
		c2 += 1
if c1 > c2:
	print('contest')
else:
	print('home')


def main():
	n = int(input())
	home = input()
	home_list = []
	table = {}
	for x in range(n):
		buff = input().split('->')
		(tfr, tto) = (buff[0], buff[1])
		if tfr == home:
			home_list.append(tto)
		elif tfr in table.keys():
			table[tfr] += 1
		else:
			table[tfr] = 1
	result = 'home'
	for x in home_list:
		if not x in table.keys() or table[x] == 0:
			result = 'contest'
			break
		else:
			table[x] -= 1
	print(result)
main()


n = int(input())
f = input()
h = [input() for i in range(n)]
print(['home', 'contest'][n % 2])


import math
n = input()
s = 0
h = input()
dep = []
arr = []
for i in range(int(n)):
	found = 0
	input1 = input()
	d = input1[:3]
	a = input1[5:]
	if i == 0:
		dep += [d]
		arr += [a]
		s = s + 1
		found = 1
	else:
		for j in range(len(dep)):
			if dep[j] == a and arr[j] == d:
				dep[j] = -1
				arr[j] = -1
				s = s - 1
				found = 1
				break
	if found == 0:
		dep += [d]
		arr += [a]
		s = s + 1
		found = 1
if s == 0:
	print('home')
else:
	print('contest')


n = int(input())
h = input()
d = []
for _ in range(n):
	s = input()
	fr = s[:3]
	to = s[5:]
	if (to, fr) in d:
		del d[d.index((to, fr))]
	else:
		d.append((fr, to))
if len(d):
	print('contest')
else:
	print('home')


n = int(input())
home = input()
have = dict()
for _ in range(n):
	var = input()
	a = var[0:3]
	b = var[len(var) - 3:]
	if a in have:
		have[a] += 1
	else:
		have[a] = 1
	if b in have:
		have[b] += 1
	else:
		have[b] = 1
ans = 1
for (i, j) in have.items():
	if j & 1:
		ans = 0
if ans:
	print('home')
else:
	print('contest')


n = int(input())
home = input().strip()
departure_from_home = 0
num_destination_to_home = 0
for i in range(n):
	(departure, destination) = input().split('->')
	if departure == home:
		departure_from_home += 1
	if destination == home:
		num_destination_to_home += 1
if departure_from_home == num_destination_to_home:
	print('home')
else:
	print('contest')


def main():
	n = int(input())
	home_aprt = str(input())
	balance = 0
	for i in range(n):
		(f, s) = input().split('->')
		if f == home_aprt:
			balance += 1
		else:
			balance -= 1
	if balance == 0:
		print('home')
	else:
		print('contest')
main()


n = int(input())
home = str(input())
L = []
count = 0
for i in range(n):
	g = str(input())
	L.append(g[0:3])
	L.append(g[5:8])
count = L.count(home)
if count % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
lis = []
home = input()
for i in range(n):
	(a, b) = map(str, input().split('->'))
	lis.append(a)
	lis.append(b)
k = lis.count(home)
if k % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
g = input()
l = []
l1 = []
for i in range(n):
	V = input().split('->')
	l.append(V[0])
	l1.append(V[1])
if sorted(l) == sorted(l1):
	print('home')
else:
	print('contest')


import sys
tmp = {}
n = int(input())
home = input()
for i in range(n):
	s = input()
	if s[:3] == home:
		yy = s[:3] + s[5:]
		if tmp.get(yy, '?') == '?':
			tmp[yy] = 1
		else:
			tmp[yy] += 1
	else:
		yy = s[5:] + s[:3]
		if tmp.get(yy, '?') == '?':
			tmp[yy] = -1
		else:
			tmp[yy] -= 1
for i in tmp.values():
	if i != 0:
		print('contest')
		sys.exit()
print('home')


import math, sys, itertools
from decimal import *

def main():
	n = int(input())
	home = input()
	a = []
	for i in range(n):
		s = input()
	if n % 2 == 0:
		print('home')
	else:
		print('contest')
main()


n = int(input())
s = input()
(departures, arrivals) = (0, 0)
for _ in range(n):
	(s1, s2) = input().split('->')
	if s1 == s:
		departures += 1
	if s2 == s:
		arrivals += 1
if departures != arrivals:
	print('contest')
else:
	print('home')


n = int(input())
ht = input()
t = 0
for _ in range(n):
	l = input()
	if l[0:3] == ht:
		t -= 1
	else:
		t += 1
print(['home', 'contest'][t < 0])


n = int(input())
home = str(input())
left = 0
right = 0
for i in range(n):
	s = str(input())
	(start, dest) = s.split('->')
	if start == home:
		left += 1
	if dest == home:
		right += 1
if left == right:
	print('home')
else:
	print('contest')


n = int(input())
air = input()
con = 0
home = 0
for i in range(n):
	road = input()
	if road[0:3] == air:
		con += 1
	else:
		home += 1
if con > home:
	print('contest')
else:
	print('home')


import sys
raw_data = list()
for line in sys.stdin:
	raw_data.append(line)
nr = int(raw_data[0])
home = raw_data[1][0:3]
dept = list()
dest = list()
for idx in range(2, 2 + nr):
	dept.append(raw_data[idx][0:3])
	dest.append(raw_data[idx][5:8])
nxt = home
cnt = 0
while cnt != nr:
	try:
		idx = dept.index(nxt)
		nxt = dest[idx]
		last = nxt
	except:
		break
	dept[idx] = ''
	cnt += 1
if cnt == nr and last == home:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
flights = []
for i in range(n):
	flights += input().split('->')
it = dict(([i, 0] for i in set(flights)))
for i in flights:
	it[i] += 1
flag = 0
for i in it:
	if it[i] % 2 != 0:
		print('contest')
		flag = 1
		break
if flag != 1:
	print('home')


def Neverending_competitions():
	n = int(input())
	home = input()
	for i in range(n):
		new = input()
	if n % 2 == 0:
		return 'home'
	else:
		return 'contest'
print(Neverending_competitions())


n = int(input())
home = input()
s1 = list()
s2 = list()
for i in range(n):
	s = input()
	if s[:3] == home:
		s1.append(s[5:])
	else:
		s2.append(s[:3])
if len(s1) != len(s2):
	print('contest')
	exit(0)
s1.sort()
s2.sort()
if s1 == s2:
	print('home')
else:
	print('contest')


n = int(input())
home = str(input())
k = n
l = []
while n:
	l.append(str(input()))
	n -= 1
if k % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
r = input()
c = 0
for i in range(0, n):
	s = input()
if n % 2:
	print('contest')
else:
	print('home')


n = int(input())
s = input()
a = [input() for i in range(n)]
f = sum((s + '->' in i for i in a))
t = sum(('->' + s in i for i in a))
if f == t:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
schedule = []
for i in range(n):
	schedule.append(input())
flag = 0
vis = [0 for i in range(n)]
for i in range(n):
	if flag == 0 and (not vis[i]) and (schedule[i][0:2] == home[0:2]):
		flag = 1
		vis[i] = 1
		for j in range(n):
			if not i == j and (not vis[j]) and (schedule[i][5:7] == schedule[j][0:2]):
				flag = 0
				vis[j] = 1
				break
if flag:
	print('contest')
else:
	print('home')


num = eval(input())
home = input()
startPlace = []
arrivePlace = []
for i in range(num):
	line = list(input())
	startPlace.append(''.join(line[0:3]))
	arrivePlace.append(''.join(line[5:9]))
if num % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
if n & 1:
	print('contest')
	exit()
print('home')


n = int(input())
a = input()
q = []
w = []
for i in range(n):
	b = input()
	l = b[:b.find('-')]
	r = b[b.find('>') + 1:]
	q.append(l)
	w.append(r)
e = q.count(a)
t = w.count(a)
if e == t:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
flights = []
f_h = 0
f_nh = 0
for i in range(n):
	lst = input().split('->')
	if lst[0] == home:
		f_h += 1
	elif lst[-1] == home:
		f_nh += 1
print('home' if f_h == f_nh else 'contest')


n = int(input())
hl = input()
contest = 0
for _ in range(n):
	flight = input()
	x = flight.find(hl, 0, 3)
	if x == 0:
		contest -= 1
	else:
		contest += 1
if contest == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
flights = []
while n > 0:
	(_from, _to) = input().split('->')
	flights.append(_from)
	flights.append(_to)
	n -= 1
count = 0
for f in flights:
	if f == home:
		count += 1
if count % 2 == 0:
	print('home')
else:
	print('contest')


from operator import itemgetter
n = int(input())
s = input()
for i in range(n):
	input()
ans = (n + 1) % 2
print('home' * ans + 'contest' * (1 - ans))


a = int(input())
temp = input()
for i in range(a):
	str = input()
print(['home', 'contest'][a % 2])


x = int(input())
for i in range(x + 1):
	y = input()
print(['home', 'contest'][x % 2])


n = int(input())
home = input()
cur = home
flights = []
for _ in range(n):
	(u, v) = input().split('->')
	flights.append([u, v])
while flights:
	flag = True
	for i in range(len(flights) - 1, -1, -1):
		if flights[i][0] == cur:
			cur = flights[i][1]
			flights.pop(i)
			flag = False
	if flag:
		break
print('home' if cur == home else 'contest')


n = int(input())
home = input()
d = {}
l = []
for i in range(n):
	(a, b) = input().split('->')
	if a == home:
		if b in d:
			d[b] += 1
		else:
			d[b] = 1
			l.append(b)
	elif a in d:
		d[a] -= 1
	else:
		d[a] = -1
		l.append(a)
for i in l:
	if d[i] != 0:
		print('contest')
		break
else:
	print('home')


n = int(input())
s = []
h = input()
for _ in range(n):
	s.append(input())
if n % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
l = str(input())
m = []
count = 0
for i in range(n):
	a = list(input())
	m.append(a)
	p = m[i][0:3]
	h = ''.join(p)
	x = m[i][5:9]
	s = ''.join(x)
	if h == l:
		count += 1
	if s == l:
		count += 1
if count % 2 == 0:
	print('home')
else:
	print('contest')


n = int(input())
home = input()
A = []
B = []
for i in range(n):
	s = input().split('->')
	A.append(s[0])
	B.append(s[1])
if n % 2 == 0:
	print('home')
else:
	print('contest')


from collections import defaultdict
c = 1
cases = 1
while c <= cases:
	n = int(input())
	home = input()
	iten = defaultdict(list)
	for i in range(0, n):
		cur = input().split('->')
		iten[cur[0]].append(cur[1])
	ans = 'home'
	cur = home
	while True:
		if cur in iten:
			if cur != home and home in iten[cur]:
				del iten[cur][iten[cur].index(home)]
				cur = home
			elif cur != home:
				ans = 'contest'
				break
			elif cur == home and len(iten[cur]) > 0:
				cur2 = iten[cur][0]
				iten[cur].pop(0)
				cur = cur2
			elif cur == home:
				break
		else:
			ans = 'contest'
			break
	print(ans)
	c = c + 1


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return list(map(int, input().split()))

def II():
	return int(input())

def LS():
	return input().split()

def S():
	return input()

def main():
	n = II()
	if n % 2 == 0:
		return 'home'
	return 'contest'
print(main())