# E - Roadwork
from bisect import bisect_left
from operator import itemgetter


def main():
    N, Q, *STXD = map(int, open(0).read().split())
    STX, D = sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)), STXD[3 * N :]
    ans = [-1] * Q
    road = [-1] * Q  # (road[i] = x) := if -1: open / else: closed until x
    for s, t, x in STX:
        l, r = bisect_left(D, s - x), bisect_left(D, t - x)
        while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main() from bisect import bisect_left from operator import itemgetter def main():
    N, Q, *STXD = map(int, open(0).read().split())
    STX, D = sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)), STXD[3 * N :]
    ans = [-1] * Q
    road = [-1] * Q  # (road[i] = x) := if -1: open / else: closed until x
    for s, t, x in STX:
        l, r = bisect_left(D, s - x), bisect_left(D, t - x)
        while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
    print("\n".join(map(str, ans))) main N, Q, *STXD = map(int, open(0).read().split()) N map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split Q *STXD STXD STX, D = sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)), STXD[3 * N :] STX sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)) sorted zip(*[iter(STXD[: 3 * N])] * 3) zip *[iter(STXD[: 3 * N])] * 3 [iter(STXD[: 3 * N])] * 3 [iter(STXD[: 3 * N])] iter(STXD[: 3 * N]) iter STXD[: 3 * N] STXD : 3 * N 3 * N 3 N 3 key=itemgetter(2) key itemgetter(2) itemgetter 2 D STXD[3 * N :] STXD 3 * N : 3 * N 3 N ans = [-1] * Q ans [-1] * Q [-1] -1 Q road = [-1] * Q road [-1] * Q [-1] -1 Q for s, t, x in STX:
        l, r = bisect_left(D, s - x), bisect_left(D, t - x)
        while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
     s t x STX l, r = bisect_left(D, s - x), bisect_left(D, t - x) l bisect_left(D, s - x) bisect_left D s - x s x r bisect_left(D, t - x) bisect_left D t - x t x while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
     l < r l r if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
     road[l] == -1 road[l] road l -1 ans[l] = x ans[l] ans l x road[l] = r road[l] road l r l += 1 l 1 l = road[l] l road[l] road l print("\n".join(map(str, ans))) print "\n".join(map(str, ans)) "\n".join "\n" join map(str, ans) map str ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N, Q, *STXD = map(int, open(0).read().split())
    STX, D = sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)), STXD[3 * N :]
    ans = [-1] * Q
    road = [-1] * Q  # (road[i] = x) := if -1: open / else: closed until x
    for s, t, x in STX:
        l, r = bisect_left(D, s - x), bisect_left(D, t - x)
        while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
    print("\n".join(map(str, ans))) def main():
    N, Q, *STXD = map(int, open(0).read().split())
    STX, D = sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)), STXD[3 * N :]
    ans = [-1] * Q
    road = [-1] * Q  # (road[i] = x) := if -1: open / else: closed until x
    for s, t, x in STX:
        l, r = bisect_left(D, s - x), bisect_left(D, t - x)
        while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
    print("\n".join(map(str, ans))) main
# E - Roadwork
from bisect import bisect_left
from operator import itemgetter


def main():
    N, Q, *STXD = map(int, open(0).read().split())
    STX, D = sorted(zip(*[iter(STXD[: 3 * N])] * 3), key=itemgetter(2)), STXD[3 * N :]
    ans = [-1] * Q
    road = [-1] * Q  # (road[i] = x) := if -1: open / else: closed until x
    for s, t, x in STX:
        l, r = bisect_left(D, s - x), bisect_left(D, t - x)
        while l < r:
            if road[l] == -1:
                ans[l] = x
                road[l] = r
                l += 1
            else:
                l = road[l]
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()
