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

menor_t, menor_c = 1000, 1000

index = 0

for i in range(a):

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

    if t <= b:

        if c < menor_c:

            menor_c = c

        index = i + 1

if index == 0:

    print('TLE')

else:

    print(menor_c)
fline = eval(input())

it, max_time = [int(n) for n in fline.split()]





cost_time = []

for i in range(it):

    line = eval(input())

    c, t = [int(n) for n in line.split()]

    pair = (c, t)

    cost_time.append(pair)



cost_time.sort(key=lambda x: x[1])

cost_time2 = []

for i in range(it):

    tupl = cost_time[i]

    if(tupl[1]<=max_time):

        cost_time2.append(cost_time[i])



cost_time2.sort(key=lambda x: x[0])

if(len(cost_time2)==0):

    print('TLE')

else:

    el = cost_time2[0]

    print((el[0]))
a, b = list(map(int, input().split()))
menor_t, menor_c = 1000, 1000
index = 0
for i in range(a):
    c, t = list(map(int, input().split()))
    if t <= b:
        if c < menor_c:
            menor_c = c
        index = i + 1
if index == 0:
    print("TLE")
else:
    print(menor_c)

fline = eval(input())
it, max_time = [int(n) for n in fline.split()]
cost_time = []
for i in range(it):
    line = eval(input())
    c, t = [int(n) for n in line.split()]
    pair = (c, t)
    cost_time.append(pair)
cost_time.sort(key=lambda x: x[1])
cost_time2 = []
for i in range(it):
    tupl = cost_time[i]
    if tupl[1] <= max_time:
        cost_time2.append(cost_time[i])
cost_time2.sort(key=lambda x: x[0])
if len(cost_time2) == 0:
    print("TLE")
else:
    el = cost_time2[0]
    print((el[0]))

-a, b = list(map(int, input().split())) -menor_t, menor_c = 1000, 1000 -index = 0 -for i in range(a): -    c, t = list(map(int, input().split())) -    if t <= b: -        if c < menor_c: -            menor_c = c -        index = i + 1 -if index == 0: +fline = eval(input()) +it, max_time = [int(n) for n in fline.split()] +cost_time = [] +for i in range(it): +    line = eval(input()) +    c, t = [int(n) for n in line.split()] +    pair = (c, t) +    cost_time.append(pair) +cost_time.sort(key=lambda x: x[1]) +cost_time2 = [] +for i in range(it): +    tupl = cost_time[i] +    if tupl[1] <= max_time: +        cost_time2.append(cost_time[i]) +cost_time2.sort(key=lambda x: x[0]) +if len(cost_time2) == 0: -    print(menor_c) +    el = cost_time2[0] +    print((el[0]))