n,t = list(map(int,input().split()))

 

minc = -1

for i in range(n):

  ci,ti = list(map(int,input().split()))

  if ti <= t:

    if minc == -1:

      minc = ci

    else:

      minc = min(minc,ci)

 

if minc == -1:

  print("TLE")

else:

  print(minc)
a,b= list(map(int,input().split()))

e=[]

for i in range(a):

    c,d=list(map(int,input().split()))

    if b>=d:

        e.append(c)

if e==[]:

    print("TLE")

else:

    print((min(e)))
n, t = list(map(int, input().split()))
minc = -1
for i in range(n):
    ci, ti = list(map(int, input().split()))
    if ti <= t:
        if minc == -1:
            minc = ci
        else:
            minc = min(minc, ci)
if minc == -1:
    print("TLE")
else:
    print(minc)

a, b = list(map(int, input().split()))
e = []
for i in range(a):
    c, d = list(map(int, input().split()))
    if b >= d:
        e.append(c)
if e == []:
    print("TLE")
else:
    print((min(e)))

-n, t = list(map(int, input().split())) -minc = -1 -for i in range(n): -    ci, ti = list(map(int, input().split())) -    if ti <= t: -        if minc == -1: -            minc = ci -        else: -            minc = min(minc, ci) -if minc == -1: +a, b = list(map(int, input().split())) +e = [] +for i in range(a): +    c, d = list(map(int, input().split())) +    if b >= d: +        e.append(c) +if e == []: -    print(minc) +    print((min(e)))