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.fromList . map read <$> replicateM a getLine :: IO (S.Set Int)                                                                              
  ts <- S.fromList . map read <$> replicateM b getLine :: IO (S.Set Int)                                                                              
  xs <- replicateM q readLn :: IO [Int]                                                                                                               
                                                                                                                                                      
  let anssg = map (\x -> fromMaybe (10^11) $ S.lookupGE x ss) xs                                                                                      
      anssl = map (\x -> fromMaybe (negate $ 10^11) $ S.lookupLE x ss) xs                                                                             
      anstg = map (\x -> fromMaybe (10^11) $ S.lookupGE x ts) xs                                                                                      
      anstl = map (\x -> fromMaybe (negate $ 10^11) $ S.lookupLE x ts) xs                                                                             
                                                                                                                                                      
  print $ zipWith5 (\x y z u v -> minimum                                                                                                             
                                  [x-y+abs(y-u)                                                                                                       
                                  ,x-y+abs(y-v)                                                                                                       
                                  ,z-x+abs(z-u)                                                                                                       
                                  ,z-x+abs(z-v)                                                                                                       
                                  ,x-u+abs(u-y)                                                                                                       
                                  ,x-u+abs(u-z)                                                                                                       
                                  ,v-x+abs(v-y)                                                                                                       
                                  ,v-x+abs(v-z)]) xs anssl anssg anstl anstg