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

min_c = 10**4

for i in range(n):

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

    if t<=T and min_c>c:

        min_c = c

print(('TLE' if min_c==10**4 else min_c))
ans = 10**10

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

for i in range(n):

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

    if t<=time and c<ans:

        ans = c

print(('TLE' if ans==10**10 else ans))
n, T = list(map(int, input().split()))
min_c = 10**4
for i in range(n):
    c, t = list(map(int, input().split()))
    if t <= T and min_c > c:
        min_c = c
print(("TLE" if min_c == 10**4 else min_c))

ans = 10**10
n, time = list(map(int, input().split()))
for i in range(n):
    c, t = list(map(int, input().split()))
    if t <= time and c < ans:
        ans = c
print(("TLE" if ans == 10**10 else ans))

-n, T = list(map(int, input().split())) -min_c = 10**4 +ans = 10**10 +n, time = list(map(int, input().split())) -    if t <= T and min_c > c: -        min_c = c -print(("TLE" if min_c == 10**4 else min_c)) +    if t <= time and c < ans: +        ans = c +print(("TLE" if ans == 10**10 else ans))