mod = 998244353 def main(): import sys input = sys.stdin.buffer.readline class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i def lower_bound(self, w): if w <= 0: return 0 x = 0 k = 1 << (self.size.bit_length() - 1) while k: if x + k <= self.size and self.tree[x + k] < w: w -= self.tree[x + k] x += k k >>= 1 return x + 1 N, K, Q = map(int, input().split()) ope = [] for _ in range(K): ope.append(tuple(map(int, input().split()))) query = [] for _ in range(Q): query.append(tuple(map(int, input().split()))) OK = [K] * Q NG = [-1] * Q for _ in range(K.bit_length()): MID = [(ok + ng) // 2 for ok, ng in zip(OK, NG)] T = [[] for _ in range(K+1)] for i, t in enumerate(MID): T[t].append(i) bit = Bit(N+1) for k in range(K): l, r, c, h = ope[k] bit.add(l, h) bit.add(r + 1, -h) for i in T[k]: j, x = query[i] hh = bit.sum(j) if x <= hh: OK[i] = MID[i] else: NG[i] = MID[i] for i in range(Q): k = OK[i] if k < K: _, _, c, _ = ope[k] print(c) else: print(-1) if __name__ == '__main__': main()