#!/usr/bin/env python3
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))

t, w, l = 0, 0, 0

for x in a:
    for y in b:
        if x>y:
            w+=1
        elif x<y:
            l+=1
        else:
            t+=1

if w==l:
    print("tie")
elif w>l:
    print("first")
else:
    print("second")
