import Control.Monad
import Data.List
import qualified Data.Map as Map

f::[String]->[[Int]]
f []=[]
f (x:xs)=((map read . words) x::[Int]) : f xs

f2::Int->[[Int]]->[[Int]]->Map.Map Int Int->Map.Map Int [Int]->Map.Map (Int,Int) Int->Map.Map (Int,Int) Int
f2 _ _ [] _ _ ms3=ms3
f2 _ [] _ _ _ ms3=ms3
f2 p xs2@((l1:r1:[]):xs) qs2@((l2:r2:[]):qs) ms1 ms2 ms3
               |l1<l2=let ms1a=Map.insertWith (+) r1 (-1)  ms1
                      in f2 p xs qs2 ms1a ms2 ms3
               |p<l2=f2 (p+1) xs2 qs2 ms1 ms2 ms3
               |otherwise=if not (Map.lookup l2 ms2==Nothing) then 
                                  let (Just rs)=Map.lookup l2 ms2
                                      ms2a=Map.delete l2 ms2
                                      ms3a=f3 p p 0 (reverse rs) ms1 ms3
                                  in f2 p xs2 qs ms1 ms2a ms3a
                          else f2 p xs2 qs ms1 ms2 ms3

f3 :: Int->Int->Int->[Int]->Map.Map Int Int->Map.Map (Int,Int) Int->Map.Map (Int,Int) Int
f3 _ _ _ [] _ ms3=ms3
f3 l1 r1 sum (x:xs) ms1 ms3
           |x<r1 =f3 l1 r1 sum xs ms1 ms3
           |r1==x =let (Just add)= (if Map.lookup r1 ms1==Nothing then (Just 0) else Map.lookup r1 ms1)
                       sum2=sum+add
                       ms3a=Map.insert (l1,r1) sum2 ms3
                   in f3 l1 (r1+1) sum2 xs ms1 ms3a
           |otherwise =let (Just add)= (if Map.lookup r1 ms1==Nothing then (Just 0) else Map.lookup r1 ms1)
                           sum2=sum+add
                       in f3 l1 (r1+1) sum2 (x:xs) ms1 ms3

f4 :: [[Int]]->Map.Map (Int,Int) Int->[String]
f4 [] _=[]
f4 ((l1:r1:[]):qs) ms=if not (Map.lookup (l1,r1) ms==Nothing) then
                          let (Just x)=Map.lookup (l1,r1) ms
                          in (show x):f4 qs ms
                      else "0":f4 qs ms

f5 :: Int->[(Int,Int)]->[(Int,[Int])]->[(Int,[Int])]
f5 _ [] zs=zs
f5 p1 ((l1,r1):xs) []=f5 p1 xs [(l1,[r1])] 
f5 p1 xs2@((l1,r1):xs) zs2@((z1,z2):zs)
    |p1<l1=f5 l1 xs2 ((l1,[]):zs2)
    |p1>l1=f5 p1 xs zs2
    |p1==l1=f5 p1 xs $ ((z1,(r1:z2)):zs)

main = do
       a<-getLine
       let (n:m:q:[])=(map read .words) a::[Int]
       xs<-replicateM m getLine
       qs<-replicateM q getLine
       let qs2=f qs
           qs3=sort qs2
           xs2=sort $ f xs
           ms1=Map.fromListWith (+) $ zip (map (\(x:y:[])->y) xs2) (repeat 1::[Int])
           t1=(map (\(x:y:[])->(x,y) ) qs3)
           ms2=Map.fromList $ f5 1 t1 []
           ms3=Map.fromList [((0,0),0)]
           ans1=f2 1 xs2 qs3 ms1 ms2 ms3
       mapM_ putStrLn $ f4 qs2 ans1