#BIT plus ver class BITplus: def __init__(self,N): self.N = N self.bit = [0] * (self.N+1) def add(self,i,x): while i <= self.N: self.bit[i] += x i += i & -i def fold(self,i): ans = 0 while i > 0: ans += self.bit[i] i -= i & -i return ans def lb(self,w): if w <= 0:return 0 x = 0 k = 1 while k <= self.N: k <<= 1 k >>= 1 while k: if x + k <= self.N and self.bit[x+k] < w: w -= self.bit[x+k] x += k k >>= 1 return x + 1 #サイズ N の配列をいれる def build(self,seq): bit = self.bit N = self.N for i in range(N): bit[i+1] = seq[i] for i in range(1,N+1): if i + (i & -1) <= N: bit[i + (i & -i)] += bit[i] import sys rr = sys.stdin N,K,Q = map(int,rr.readline().split()) sousa = [[] for _ in range(N + 2)] col = [] for _ in range(K): l,r,c,h = map(int,rr.readline().split()) sousa[l].append((_,h)) sousa[r + 1].append((_,-h)) col.append(c) bit = BITplus(K) query = [] for _ in range(Q): i,x = map(int,input().split()) query.append((i,x,_)) query.sort(key = lambda x:x[0]) ans = [0] * Q now = 0 for i,x,_ in query: while now <= i: for q,d in sousa[now]: bit.add(q + 1,d) now += 1 tmp = bit.fold(K) #print(tmp) if tmp < x: ans[_] = -1 continue t = bit.lb(x) ans[_] = col[t - 1] print(*ans,sep = "\n")