from bisect import bisect_left as b;n,q=map(int,input().split());w=sorted([list(map(int,input().split()))[::-1]for _ in[0]*n]);p=[int(input())for _ in[0]*q];a=[-1]*q;o=[-1]*q
for x,t,s in w:
  l,r=b(p,s-x),b(p,t-x)
  while l<r:
    if o[l]+1:l=o[l]
    else:a[l],o[l]=x,r;l+=1
print(*a) int(input())for _ in[0]*q for _ in[0]*q _ [0]*q [0] 0 q for _ in[0]*q int(input()) int input() input from bisect import bisect_left as b n,q=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split q w=sorted([list(map(int,input().split()))[::-1]for _ in[0]*n]) w sorted([list(map(int,input().split()))[::-1]for _ in[0]*n]) sorted [list(map(int,input().split()))[::-1]for _ in[0]*n] p=[int(input())for _ in[0]*q] p [int(input())for _ in[0]*q] a=[-1]*q a [-1]*q [-1] -1 q o=[-1]*q o [-1]*q [-1] -1 q for x,t,s in w:
  l,r=b(p,s-x),b(p,t-x)
  while l<r:
    if o[l]+1:l=o[l]
    else:a[l],o[l]=x,r;l+=1 x t s w l,r=b(p,s-x),b(p,t-x) l b(p,s-x) b p s-x s x r b(p,t-x) b p t-x t x while l<r:
    if o[l]+1:l=o[l]
    else:a[l],o[l]=x,r;l+=1 l<r l r if o[l]+1:l=o[l]
    else:a[l],o[l]=x,r;l+=1 o[l]+1 o[l] o l 1 print(*a) print *a a q=map(int,input().split()) map(int,input().split()) q w=sorted([list(map(int,input().split()))[::-1]for _ in[0]*n]) sorted([list(map(int,input().split()))[::-1]for _ in[0]*n]) w o=[-1]*q [-1]*q o p=[int(input())for _ in[0]*q] [int(input())for _ in[0]*q] p a=[-1]*q [-1]*q a n,q=map(int,input().split()) map(int,input().split()) n l,r=b(p,s-x),b(p,t-x) b(p,s-x) l r=b(p,s-x),b(p,t-x) b(p,t-x) r
from bisect import bisect_left as b;n,q=map(int,input().split());w=sorted([list(map(int,input().split()))[::-1]for _ in[0]*n]);p=[int(input())for _ in[0]*q];a=[-1]*q;o=[-1]*q
for x,t,s in w:
  l,r=b(p,s-x),b(p,t-x)
  while l<r:
    if o[l]+1:l=o[l]
    else:a[l],o[l]=x,r;l+=1
print(*a)