
{-# LANGUAGE OverloadedLists   #-}

import Prelude as P
import Data.List (sort)
import Control.Monad as M
import Data.Vector.Unboxed as V
import Debug.Trace

inf = -1*10^10

b_search :: Vector Int -> Int -> Int -> Int -> Int --low
b_search vec low high x
  | high <= low + 1 = low
  | vec!mid  <  x   = b_search vec mid high x
  | otherwise       = b_search vec low mid x
  where mid = div (low+high) 2

neighbor :: Vector Int -> Int -> Int -> (Int,Int)
neighbor vec n x | x <= V.head vec = (inf,V.head vec)
                 | V.last vec <= x = (V.last vec,inf)
                 | otherwise       = (vec!low,vec!(low+1))
                   where low = b_search vec 0 (n-1) x


find0 :: [Int] -> [Int] -> Int -> Int -> IO ()
find0 as bs a b = do
   x <- read <$> getLine :: IO Int
   let (s1',s2') = neighbor (V.fromList as) a x
       (t1',t2') = neighbor (V.fromList bs) b x
       s1 = abs $ x-s1'
       s2 = abs $ x-s2'
       t1 = abs $ x-t1'
       t2 = abs $ x-t2'
   print $ V.minimum [2*s1+t2, 2*t1+s2, 2*s2+t1, 2*t2+s1 ,max s1 t1, max s2 t2]

main :: IO ()
main = do
    [a,b,q] <- P.map read.words <$> getLine :: IO [Int]
    as <- M.replicateM a $ read <$> getLine :: IO [Int]
    bs <- M.replicateM b $ read <$> getLine :: IO [Int]
    replicateM_ q $ find0 (sort as) (sort bs) a b
