# 制約チェック line = list(map(int, input().split())) assert len(line) == 2 N, Q = line assert 2 <= N <= 200000 assert 2 <= Q <= 200000 p = [0] * (N+2) for _ in range(N): line = list(map(int, input().split())) assert len(line) == 3 L, R, C = line assert 1 <= L <= R <= N p[L] += 1 p[R + 1] -= 1 assert 1 <= C <= 1_000_000_000 for i in range(0, N+1): p[i+1] += p[i] assert 0 <= p[i] <= 5 assert 0 <= p[N+1] <= 5 for _ in range(Q): line = list(map(int, input().split())) assert len(line) == 2 a, b = line assert 1 <= a < b <= N