#!/usr/bin/python3

import random

n = int(input())
l = [int(x) for x in input().split()]
m = [int(x) for x in input().split()]
random.seed(0)
eps = 0.001

ct1 = 0
ct2 = 0

for _ in range(1000000):
    cl = random.choice(l)
    cm = random.choice(m)
    if cl > cm:
        ct1 += 1
    elif cl < cm:
        ct2 += 1

if (ct2 > 0 and 1 - eps < ct1/ct2 < 1 + eps) or ct1 == ct2 == 0:
    print("tie")
elif ct2 > ct1:
    print("second")
else:
    print("first")

