import qualified Data.Set as S
import Data.Maybe

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.fromDistinctAscList (-10000000000:ss ++ [20000000000]))
                 (S.fromDistinctAscList (-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 = (map fromJust [S.lookupLE x ss, S.lookupGE x ss]
                ,map fromJust [S.lookupLE x ts, S.lookupGE x ts])

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