import Data.List hiding (find)
import Control.Monad
import Data.Array.Unboxed

binary_search :: UArray Int Int -> (Int,Int) -> Int -> Int
binary_search arr (low,high) x
  | high == low {- == 1 -} = if x < arr!low then 0 else low
  | high == low + 1 = if arr!low > x then 0
     else if arr!high < x then high else low
  | otherwise   = if arr!mid <= x
    then binary_search arr (mid,high) x
    else binary_search arr (low,mid) x
    where mid = ((low+high)`div`2)

neighbor :: UArray Int Int -> Int -> Int -> (Int,Int) -- s s t t
neighbor arr n x = if low == n then (arr!n,2*10^10)
  else if low == 0 then (-1*10^10,arr!1)
  else (arr!low,arr!(low+1))
  where low = binary_search arr (1,n) x

find :: [Int] -> [Int] -> Int -> Int -> IO ()
find as bs a b = do
   x <- read <$> getLine
   let (s1',s2') =  neighbor (listArray (1,a) as) a x
       (t1',t2') = neighbor (listArray (1,b) bs) b x
       s1 = abs $ x-s1'
       s2 = abs $ x-s2'
       t1 = abs $ x-t1'
       t2 = abs $ x-t2'
   print $ 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] <- map read.words <$> getLine :: IO [Int]
    as <- replicateM a $ read <$> getLine
    bs <- replicateM b $ read <$> getLine
    print "------------"
    replicateM_ q $ find (sort as) (sort bs) a b
