@staticmethod
def c():
    (n, d, k, *lrst) = map(int, sys.stdin.read().split())
    lrst = np.array(lrst)
    lr = lrst[:(2 * d)].reshape(d, 2)
    (s, t) = lrst[(2 * d):].reshape(k, 2).T
    day = np.zeros((k,), dtype=np.int32)
    for i in range(d):
        (l, r) = lr[i]
        move = (((l <= s) & (s <= r)) & (s != t))
        reach = ((move & (l <= t)) & (t <= r))
        s[(move & (s < t))] = r
        s[(move & (s > t))] = l
        s[reach] = t[reach]
        day[reach] = (i + 1)
    print(*day, sep='\n')
@staticmethod
def c():
    (n, d, k, *lrst) = map(int, sys.stdin.read().split())
    lrst = np.array(lrst)
    lr = lrst[:(2 * d)].reshape(d, 2)
    (s, t) = lrst[(2 * d):].reshape(k, 2).T
    day = np.zeros((k,), dtype=np.int32)
    for i in range(d):
        (l, r) = lr[i]
        move = (((l <= s) & (s <= r)) & (s != t))
        reach = ((move & (l <= t)) & (t <= r))
        s[(move & (s < t))] = r
        s[(move & (s > t))] = l
        s[reach] = t[reach]
        day[reach] = (i + 1)
    print(*day, sep='\n')