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

ea = sum(a)
eb = sum(b)

if ea > eb:
    print("first")
elif ea < eb:
    print("second")
else:
    print("tie")
