import sys
import bisect
input = sys.stdin.readline

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

cons.sort(key=lambda x: x[2])
for i in range(n):
    cons[i][0] -= cons[i][2]
    cons[i][1] -= cons[i][2]

ans = [-1] * q
l = [-1] * q
for i in range(n):
    s = bisect.bisect_left(d, cons[i][0])
    t = bisect.bisect_left(d, cons[i][1])
    while s < t:
        if l[s] != -1:
            s = l[s]
        else:
            ans[s] = cons[i][2]
            l[s] = t
            s += 1
print(*ans, sep="\n") import sys sys import bisect bisect input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 cons = [list(map(int, input().split())) for _ in range(n)] cons [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)] cons.sort(key=lambda x: x[2]) cons.sort cons sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x for i in range(n):
    cons[i][0] -= cons[i][2]
    cons[i][1] -= cons[i][2] i range(n) range n cons[i][0] -= cons[i][2] cons[i][0] [i] cons i 0 cons[i][2] [i] cons i 2 cons[i][1] -= cons[i][2] cons[i][1] [i] cons i 1 cons[i][2] [i] cons i 2 ans = [-1] * q ans [-1] * q [-1] -1 q l = [-1] * q l [-1] * q [-1] -1 q for i in range(n):
    s = bisect.bisect_left(d, cons[i][0])
    t = bisect.bisect_left(d, cons[i][1])
    while s < t:
        if l[s] != -1:
            s = l[s]
        else:
            ans[s] = cons[i][2]
            l[s] = t
            s += 1 i range(n) range n s = bisect.bisect_left(d, cons[i][0]) s bisect.bisect_left(d, cons[i][0]) bisect.bisect_left bisect bisect_left d cons[i][0] [i] cons i 0 t = bisect.bisect_left(d, cons[i][1]) t bisect.bisect_left(d, cons[i][1]) bisect.bisect_left bisect bisect_left d cons[i][1] [i] cons i 1 while s < t:
        if l[s] != -1:
            s = l[s]
        else:
            ans[s] = cons[i][2]
            l[s] = t
            s += 1 s < t s t if l[s] != -1:
            s = l[s]
        else:
            ans[s] = cons[i][2]
            l[s] = t
            s += 1 l[s] != -1 l[s] l s -1 s = l[s] s l[s] l s ans[s] = cons[i][2] ans[s] ans s cons[i][2] [i] cons i 2 l[s] = t l[s] l s t s += 1 s 1 print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" q = map(int, input().split()) map(int, input().split()) q l = [-1] * q [-1] * q l s = l[s] l[s] s s += 1 1 s t = bisect.bisect_left(d, cons[i][1]) bisect.bisect_left(d, cons[i][1]) t d = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] d input = sys.stdin.readline sys.stdin.readline input s = bisect.bisect_left(d, cons[i][0]) bisect.bisect_left(d, cons[i][0]) s ans = [-1] * q [-1] * q ans n, q = map(int, input().split()) map(int, input().split()) n cons = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] cons
import sys
import bisect
input = sys.stdin.readline

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

cons.sort(key=lambda x: x[2])
for i in range(n):
    cons[i][0] -= cons[i][2]
    cons[i][1] -= cons[i][2]

ans = [-1] * q
l = [-1] * q
for i in range(n):
    s = bisect.bisect_left(d, cons[i][0])
    t = bisect.bisect_left(d, cons[i][1])
    while s < t:
        if l[s] != -1:
            s = l[s]
        else:
            ans[s] = cons[i][2]
            l[s] = t
            s += 1
print(*ans, sep="\n")