import sys

n, q = map(int, input().split())
lines = sys.stdin.readlines()
coordinates = set()
kkk = []
for line in lines[:n]:
    s, t, x = map(int, line.split())
    sx = s - x
    tx = t - x
    kkk.append((x, sx, tx))
    coordinates.add(sx)
    coordinates.add(tx)
kkk.sort()
ddd = list(map(int, lines[n:]))
coordinates.update(ddd)
coordinates = {d: i for i, d in enumerate(sorted(coordinates))}
coord_len = len(coordinates)

ans = [-1] * coord_len
skip = [-1] * coord_len
for x, sx, tx in kkk:
    ss = coordinates[sx]
    tt = coordinates[tx]
    while ss < tt:
        sk = skip[ss]
        if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = sk
print('\n'.join(map(str, map(ans.__getitem__, map(coordinates.get, ddd))))) import sys sys n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q lines = sys.stdin.readlines() lines sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines coordinates = set() coordinates set() set kkk = [] kkk [] for line in lines[:n]:
    s, t, x = map(int, line.split())
    sx = s - x
    tx = t - x
    kkk.append((x, sx, tx))
    coordinates.add(sx)
    coordinates.add(tx) line lines[:n] lines :n n s, t, x = map(int, line.split()) s map(int, line.split()) map int line.split() line.split line split t x sx = s - x sx s - x s x tx = t - x tx t - x t x kkk.append((x, sx, tx)) kkk.append kkk append (x, sx, tx) x sx tx coordinates.add(sx) coordinates.add coordinates add sx coordinates.add(tx) coordinates.add coordinates add tx kkk.sort() kkk.sort kkk sort ddd = list(map(int, lines[n:])) ddd list(map(int, lines[n:])) list map(int, lines[n:]) map int lines[n:] lines n: n coordinates.update(ddd) coordinates.update coordinates update ddd d: i for i, d in enumerate(sorted(coordinates)) for i, d in enumerate(sorted(coordinates)) i d enumerate(sorted(coordinates)) enumerate sorted(coordinates) sorted coordinates for i, d in enumerate(sorted(coordinates)) d i coordinates = {d: i for i, d in enumerate(sorted(coordinates))} coordinates {d: i for i, d in enumerate(sorted(coordinates))} coord_len = len(coordinates) coord_len len(coordinates) len coordinates ans = [-1] * coord_len ans [-1] * coord_len [-1] -1 coord_len skip = [-1] * coord_len skip [-1] * coord_len [-1] -1 coord_len for x, sx, tx in kkk:
    ss = coordinates[sx]
    tt = coordinates[tx]
    while ss < tt:
        sk = skip[ss]
        if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = sk x sx tx kkk ss = coordinates[sx] ss coordinates[sx] coordinates sx tt = coordinates[tx] tt coordinates[tx] coordinates tx while ss < tt:
        sk = skip[ss]
        if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = sk ss < tt ss tt sk = skip[ss] sk skip[ss] skip ss if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = sk sk == -1 sk -1 ans[ss] = x ans[ss] ans ss x skip[ss] = tt skip[ss] skip ss tt ss += 1 ss 1 ss = sk ss sk print('\n'.join(map(str, map(ans.__getitem__, map(coordinates.get, ddd))))) print '\n'.join(map(str, map(ans.__getitem__, map(coordinates.get, ddd)))) '\n'.join '\n' join map(str, map(ans.__getitem__, map(coordinates.get, ddd))) map str map(ans.__getitem__, map(coordinates.get, ddd)) map ans.__getitem__ ans __getitem__ map(coordinates.get, ddd) map coordinates.get coordinates get ddd tx = t - x t - x tx s, t, x = map(int, line.split()) map(int, line.split()) s coord_len = len(coordinates) len(coordinates) coord_len q = map(int, input().split()) map(int, input().split()) q ss = sk sk ss t, x = map(int, line.split()) map(int, line.split()) t sx = s - x s - x sx ddd = list(map(int, lines[n:])) list(map(int, lines[n:])) ddd skip = [-1] * coord_len [-1] * coord_len skip ans = [-1] * coord_len [-1] * coord_len ans coordinates = set() set() coordinates ss = coordinates[sx] coordinates[sx] ss n, q = map(int, input().split()) map(int, input().split()) n coordinates = {d: i for i, d in enumerate(sorted(coordinates))} {d: i for i, d in enumerate(sorted(coordinates))} coordinates tt = coordinates[tx] coordinates[tx] tt lines = sys.stdin.readlines() sys.stdin.readlines() lines x = map(int, line.split()) map(int, line.split()) x kkk = [] [] kkk ss += 1 1 ss sk = skip[ss] skip[ss] sk
import sys

n, q = map(int, input().split())
lines = sys.stdin.readlines()
coordinates = set()
kkk = []
for line in lines[:n]:
    s, t, x = map(int, line.split())
    sx = s - x
    tx = t - x
    kkk.append((x, sx, tx))
    coordinates.add(sx)
    coordinates.add(tx)
kkk.sort()
ddd = list(map(int, lines[n:]))
coordinates.update(ddd)
coordinates = {d: i for i, d in enumerate(sorted(coordinates))}
coord_len = len(coordinates)

ans = [-1] * coord_len
skip = [-1] * coord_len
for x, sx, tx in kkk:
    ss = coordinates[sx]
    tt = coordinates[tx]
    while ss < tt:
        sk = skip[ss]
        if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = sk
print('\n'.join(map(str, map(ans.__getitem__, map(coordinates.get, ddd)))))
