import qualified Data.Set as S

main = do
  [a,b,q] <- map read . words <$> getLine
  input   <- map read . lines <$> getContents :: IO [Integer]
  let [ss,ts,xs] = splitAts [a,b] input
  prints $ solve (S.fromList (-10000000000:ss ++ [20000000000]))
                 (S.fromList (-10000000000:ts ++ [20000000000]))
                 xs

solve _ _ [] = []
solve ss ts (x:xs) = inner ss ts x : solve ss ts xs
  where
  inner ss ts x = minimum [ abs (p2 - p1) + abs (p1 - x)
                          | (first, second) <- [(fst,snd), (snd,fst)]
                          , p1 <- first neighbors, p2 <- second neighbors]
    where
    neighbors = ([S.elemAt i ss | i <- [b-1,b] ]
                ,[S.elemAt j ts | j <- [d-1,d] ])
    b = S.size $ S.takeWhileAntitone (<x) ss
    d = S.size $ S.takeWhileAntitone (<x) ts

--splitAts [2,3] [1,2,3,4,5,6,7] = [[1,2],[3,4,5],[6,7]]
splitAts [] ys = [ys]
splitAts xs [] = []
splitAts (x:xs) ys = f : splitAts xs s
  where (f,s) = splitAt x ys

prints [] = return ()
prints (x:xs) = do
  print x
  prints xs