from heapq import heappop as hpp, heappush as hp
import sys
N, Q = map(int, input().split())
stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
stx = [(s-x, t-x, x) for s, t, x in stx]
stx.sort(reverse = True)

D = [int(sys.stdin.readline()) for _ in range(Q)] 
H = []
ans = [None]*Q

for i, d in enumerate(D):
    while stx and stx[-1][0] <= d:
        hp(H, stx.pop()[1:][::-1])    
    while H and H[0][1] <= d:
        hpp(H)
    if not H:
        ans[i] = -1
    else:
        ans[i] = H[0][0]

for a in ans:
    print(a) from heapq import heappop as hpp, heappush as hp import sys sys N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q tuple(map(int, sys.stdin.readline().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, sys.stdin.readline().split())) tuple map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] stx [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] (s-x, t-x, x) for s, t, x in stx for s, t, x in stx s t x stx for s, t, x in stx (s-x, t-x, x) s-x s x t-x t x x stx = [(s-x, t-x, x) for s, t, x in stx] stx [(s-x, t-x, x) for s, t, x in stx] stx.sort(reverse = True) stx.sort stx sort reverse = True reverse True int(sys.stdin.readline()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline D = [int(sys.stdin.readline()) for _ in range(Q)] D [int(sys.stdin.readline()) for _ in range(Q)] H = [] H [] ans = [None]*Q ans [None]*Q [None] None Q for i, d in enumerate(D):
    while stx and stx[-1][0] <= d:
        hp(H, stx.pop()[1:][::-1])    
    while H and H[0][1] <= d:
        hpp(H)
    if not H:
        ans[i] = -1
    else:
        ans[i] = H[0][0] i d enumerate(D) enumerate D while stx and stx[-1][0] <= d:
        hp(H, stx.pop()[1:][::-1])    
     stx and stx[-1][0] <= d stx stx[-1][0] <= d stx[-1][0] [-1] stx -1 0 d hp(H, stx.pop()[1:][::-1]) hp H stx.pop()[1:][::-1] [1:] stx.pop() stx.pop stx pop 1: 1 ::-1 -1 while H and H[0][1] <= d:
        hpp(H)
     H and H[0][1] <= d H H[0][1] <= d H[0][1] [0] H 0 1 d hpp(H) hpp H if not H:
        ans[i] = -1
    else:
        ans[i] = H[0][0] not H H ans[i] = -1 ans[i] ans i -1 ans[i] = H[0][0] ans[i] ans i H[0][0] [0] H 0 0 for a in ans:
    print(a) a ans print(a) print a H = [] [] H N, Q = map(int, input().split()) map(int, input().split()) N D = [int(sys.stdin.readline()) for _ in range(Q)] [int(sys.stdin.readline()) for _ in range(Q)] D stx = [(s-x, t-x, x) for s, t, x in stx] [(s-x, t-x, x) for s, t, x in stx] stx ans = [None]*Q [None]*Q ans Q = map(int, input().split()) map(int, input().split()) Q stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] stx
from heapq import heappop as hpp, heappush as hp
import sys
N, Q = map(int, input().split())
stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
stx = [(s-x, t-x, x) for s, t, x in stx]
stx.sort(reverse = True)

D = [int(sys.stdin.readline()) for _ in range(Q)] 
H = []
ans = [None]*Q

for i, d in enumerate(D):
    while stx and stx[-1][0] <= d:
        hp(H, stx.pop()[1:][::-1])    
    while H and H[0][1] <= d:
        hpp(H)
    if not H:
        ans[i] = -1
    else:
        ans[i] = H[0][0]

for a in ans:
    print(a)