from bisect import bisect_left

n, q = map(int, input().split())
stx = [list(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

INF = 10 ** 9 + 1

stx.sort(key=lambda x: x[2])

nxt = [-1] * q
ans = [-1] * q

for s, t, x in stx:
    l = bisect_left(d, s - x)
    r = bisect_left(d, t - x)

    while l < r:
        if nxt[l] == -1:
            ans[l] = x
            nxt[l] = r
            l += 1
        else:
            l = nxt[l]

print(*ans, sep="\n") from bisect import bisect_left n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split stx = [list(map(int, input().split())) for _ in range(n)] stx [list(map(int, input().split())) for _ 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)] INF = 10 ** 9 + 1 INF 10 ** 9 + 1 10 ** 9 10 9 1 stx.sort(key=lambda x: x[2]) stx.sort stx sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x nxt = [-1] * q nxt [-1] * q [-1] -1 q ans = [-1] * q ans [-1] * q [-1] -1 q for s, t, x in stx:
    l = bisect_left(d, s - x)
    r = bisect_left(d, t - x)

    while l < r:
        if nxt[l] == -1:
            ans[l] = x
            nxt[l] = r
            l += 1
        else:
            l = nxt[l] s t x stx 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 while l < r:
        if nxt[l] == -1:
            ans[l] = x
            nxt[l] = r
            l += 1
        else:
            l = nxt[l] l < r l r if nxt[l] == -1:
            ans[l] = x
            nxt[l] = r
            l += 1
        else:
            l = nxt[l] nxt[l] == -1 nxt[l] nxt l -1 ans[l] = x ans[l] ans l x nxt[l] = r nxt[l] nxt l r l += 1 l 1 l = nxt[l] l nxt[l] nxt l print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" l += 1 1 l ans = [-1] * q [-1] * q ans d = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] d nxt = [-1] * q [-1] * q nxt q = map(int, input().split()) map(int, input().split()) q INF = 10 ** 9 + 1 10 ** 9 + 1 INF r = bisect_left(d, t - x) bisect_left(d, t - x) r n, q = map(int, input().split()) map(int, input().split()) n l = bisect_left(d, s - x) bisect_left(d, s - x) l stx = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] stx l = nxt[l] nxt[l] l
from bisect import bisect_left

n, q = map(int, input().split())
stx = [list(map(int, input().split())) for _ in range(n)]
d = [int(input()) for _ in range(q)]

INF = 10 ** 9 + 1

stx.sort(key=lambda x: x[2])

nxt = [-1] * q
ans = [-1] * q

for s, t, x in stx:
    l = bisect_left(d, s - x)
    r = bisect_left(d, t - x)

    while l < r:
        if nxt[l] == -1:
            ans[l] = x
            nxt[l] = r
            l += 1
        else:
            l = nxt[l]

print(*ans, sep="\n")
