n=int(input())
t=int(input())
res=[]
for i in range(n):
    o,s,e=list(map(int,input().split()))
    if s<=t<=e:
        res.append(o)
res.sort()
if not res:
    print('null')
for v in res:
    print(v)