#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(void) {
  int n;
  scanf("%d", &n);
  char s[4], d[4], first[4];
  scanf("%s", first);
  first[3] = 0;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%3s->%3s", s, d);
    s[3] = 0, d[3] = 0;
    if (!strncmp(first, s, 3))
      ++cnt;
    if (!strncmp(first, d, 3))
      ++cnt;
  }
  if (cnt % 2)
    printf("contest\n");
  else
    printf("home\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x14(%rbp),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fa <main+0xca>
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movb   $0x0,-0x9(%rbp)
movb   $0x0,-0xd(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11c3 <main+0x93>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11e7 <main+0xb7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ec <main+0xbc>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <main+0x45>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     121f <main+0xef>
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
jmp    122b <main+0xfb>
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movb   $0x0,0xf(%rsp)
cmpl   $0x0,0x8(%rsp)
jle    11e5 <main+0xb5>
lea    0xe8f(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
xor    %ebx,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movb   $0x0,0x17(%rsp)
movb   $0x0,0x13(%rsp)
mov    %r13,%rdi
mov    %r15,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
mov    %r13,%rdi
mov    %r12,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x1,%eax
adc    $0x0,%ebp
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     1190 <main+0x60>
test   $0x1,%bpl
jne    11ee <main+0xbe>
lea    0xe23(%rip),%rdi
jmp    11f5 <main+0xc5>
lea    0xe1f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"%3s->%3s\00"
@.str.3 = [9 x i8] c"contest\0A\00"
@.str.4 = [6 x i8] c"home\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
%5 = alloca [4 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 0, i8* %11
store i32 0, i32* %6
store i32 0, i32* %7
br label %12
12: ; preds = %38, %0
%13 = load i32, i32* %7
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %41
16: ; preds = %12
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %18)
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 0, i8* %20
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
store i8 0, i8* %21
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%24 = call i32 @strncmp(i8* %22, i8* %23, i32 3)
%25 = icmp ne i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %16
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %29
29: ; preds = %26, %16
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%31 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%32 = call i32 @strncmp(i8* %30, i8* %31, i32 3)
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %29
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %37
37: ; preds = %34, %29
br label %38
38: ; preds = %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %12
41: ; preds = %12
%42 = load i32, i32* %6
%43 = srem i32 %42, 2
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %49
47: ; preds = %41
%48 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"%3s->%3s\00"
@str = [5 x i8] c"home\00"
@str.5 = [8 x i8] c"contest\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
%5 = bitcast i32* %1 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
store i8 0, i8* %11
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %35
14: ; preds = %0
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
br label %20
17: ; preds = %20
%18 = and i32 %31, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %35, label %36
20: ; preds = %14, %20
%21 = phi i32 [ 0, %14 ], [ %32, %20 ]
%22 = phi i32 [ 0, %14 ], [ %31, %20 ]
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %8)
store i8 0, i8* %15
store i8 0, i8* %16
%24 = call i32 @strncmp(i8* %9, i8* %7, i32 3)
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = add nsw i32 %22, %26
%28 = call i32 @strncmp(i8* %9, i8* %8, i32 3)
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i32
%31 = add nsw i32 %27, %30
%32 = add nuw nsw i32 %21, 1
%33 = load i32, i32* %1
%34 = icmp slt i32 %32, %33
br i1 %34, label %20, label %17
35: ; preds = %0, %17
br label %36
36: ; preds = %17, %35
%37 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0), %35 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0), %17 ]
%38 = call i32 @puts(i8* dereferenceable(1) %37)
ret i32 0
}