# 理解する時間がなかったので、とりあえず写経
from bisect import bisect_left
from operator import itemgetter

N, Q = [int(i) for i in input().split()]
Construction = [tuple(int(i) for i in input().split()) for j in range(N)]
D = [int(input()) for _ in range(Q)]

ans = [-1] * Q
skip = [-1] * Q

Construction.sort(key=itemgetter(2))

for s, t, x in Construction:
    l = bisect_left(D, s - x)
    r = bisect_left(D, t - x)
    t = l
    while t < r:
        if skip[t] == -1:
            ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
            skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
            t += 1
        else:
            t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
print(*ans, sep='\n') from bisect import bisect_left from operator import itemgetter int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N, Q = [int(i) for i in input().split()] N [int(i) for i in input().split()] Q tuple(int(i) for i in input().split()) for j in range(N) for j in range(N) j range(N) range N for j in range(N) tuple(int(i) for i in input().split()) tuple int(i) int i Construction = [tuple(int(i) for i in input().split()) for j in range(N)] Construction [tuple(int(i) for i in input().split()) for j in range(N)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q Construction.sort(key=itemgetter(2)) Construction.sort Construction sort key=itemgetter(2) key itemgetter(2) itemgetter 2 for s, t, x in Construction:
    l = bisect_left(D, s - x)
    r = bisect_left(D, t - x)
    t = l
    while t < r:
        if skip[t] == -1:
            ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
            skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
            t += 1
        else:
            t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす s t x Construction l = bisect_left(D, s - x) l bisect_left(D, s - x) bisect_left D s - x s x r = bisect_left(D, t - x) r bisect_left(D, t - x) bisect_left D t - x t x t = l t l while t < r:
        if skip[t] == -1:
            ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
            skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
            t += 1
        else:
            t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす t < r t r if skip[t] == -1:
            ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
            skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
            t += 1
        else:
            t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす skip[t] == -1 skip[t] skip t -1 ans[t] = x ans[t] ans t x skip[t] = r skip[t] skip t r t += 1 t 1 t = skip[t] t skip[t] skip t print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' ans = [-1] * Q [-1] * Q ans Q = [int(i) for i in input().split()] [int(i) for i in input().split()] Q D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D l = bisect_left(D, s - x) bisect_left(D, s - x) l r = bisect_left(D, t - x) bisect_left(D, t - x) r Construction = [tuple(int(i) for i in input().split()) for j in range(N)] [tuple(int(i) for i in input().split()) for j in range(N)] Construction t = l l t skip = [-1] * Q [-1] * Q skip t = skip[t] skip[t] t t += 1 1 t N, Q = [int(i) for i in input().split()] [int(i) for i in input().split()] N
# 理解する時間がなかったので、とりあえず写経
from bisect import bisect_left
from operator import itemgetter

N, Q = [int(i) for i in input().split()]
Construction = [tuple(int(i) for i in input().split()) for j in range(N)]
D = [int(input()) for _ in range(Q)]

ans = [-1] * Q
skip = [-1] * Q

Construction.sort(key=itemgetter(2))

for s, t, x in Construction:
    l = bisect_left(D, s - x)
    r = bisect_left(D, t - x)
    t = l
    while t < r:
        if skip[t] == -1:
            ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
            skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
            t += 1
        else:
            t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
print(*ans, sep='\n')
