import qualified Data.Set as S                                                                                                                        
import Control.Monad                                                                                                                                  
import Data.Maybe                                                                                                                                     
import Data.List                                                                                                                                      
                                                                                                                                                      
main :: IO ()                                                                                                                                         
main = do                                                                                                                                             
  [a,b,q] <- map read . words <$> getLine                                                                                                             
  ss <- S.fromAscList . map read <$> replicateM a getLine :: IO (S.Set Int)                                                                           
  ts <- S.fromAscList . map read <$> replicateM b getLine :: IO (S.Set Int)                                                                           
  xs <- replicateM q readLn :: IO [Int]                                                                                                               
                                                                                                                                                      
  let sgs = map (\x -> fromMaybe (         10^11) $ S.lookupGE x ss) xs                                                                               
      sls = map (\x -> fromMaybe (negate $ 10^11) $ S.lookupLE x ss) xs                                                                               
      tgs = map (\x -> fromMaybe (         10^11) $ S.lookupGE x ts) xs                                                                               
      tls = map (\x -> fromMaybe (negate $ 10^11) $ S.lookupLE x ts) xs                                                                               
                                                                                                                                                      
  mapM_ print $ zipWith5 (\sl tl x sg tg -> minimum                                                                                                   
                                            [x-sl+abs(sl-tl)                                                                                          
                                            ,x-sl+abs(sl-tg)                                                                                          
                                            ,sg-x+abs(sg-tl)                                                                                          
                                            ,sg-x+abs(sg-tg)                                                                                          
                                            ,x-tl+abs(tl-sl)                                                                                          
                                            ,x-tl+abs(tl-sg)                                                                                          
                                            ,tg-x+abs(tg-sl)                                                                                          
                                            ,tg-x+abs(tg-sg)]) sls tls xs sgs tgs