import sys
import bisect
input=sys.stdin.readline
a,b,q=map(int,input().split())
s=[ int(input()) for _ in range(a)]
t=[ int(input()) for _ in range(b)]
#print(s,end=" s\n")
#print(t,end=" t\n")
for _ in range(q):
  x=int(input())
  sr=bisect.bisect_left(s,x)
  sr=sr-1 if sr==len(s) else sr
  sl=sr-1 if sr>0 else sr 
  tr=bisect.bisect_left(t,x)
  tr=tr-1 if tr==len(t) else tr
  tl=tr-1 if tr>0 else tr
 # print(sl,sr,tl,tr)
  def f(i,j):
    #print( abs(x-s[i]),abs(x-t[j]))
    return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i])
#  print(x)
#  print(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
  ans=min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
  print(ans)



  

 import sys sys import bisect bisect input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s=[ int(input()) for _ in range(a)] s [ int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t=[ int(input()) for _ in range(b)] t [ int(input()) for _ in range(b)] for _ in range(q):
  x=int(input())
  sr=bisect.bisect_left(s,x)
  sr=sr-1 if sr==len(s) else sr
  sl=sr-1 if sr>0 else sr 
  tr=bisect.bisect_left(t,x)
  tr=tr-1 if tr==len(t) else tr
  tl=tr-1 if tr>0 else tr
 # print(sl,sr,tl,tr)
  def f(i,j):
    #print( abs(x-s[i]),abs(x-t[j]))
    return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i])
#  print(x)
#  print(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
  ans=min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
  print(ans)



   _ range(q) range q x=int(input()) x int(input()) int input() input sr=bisect.bisect_left(s,x) sr bisect.bisect_left(s,x) bisect.bisect_left bisect bisect_left s x sr=sr-1 if sr==len(s) else sr sr sr-1 if sr==len(s) else sr sr==len(s) sr len(s) len s sr-1 sr 1 sr sl=sr-1 if sr>0 else sr sl sr-1 if sr>0 else sr sr>0 sr 0 sr-1 sr 1 sr tr=bisect.bisect_left(t,x) tr bisect.bisect_left(t,x) bisect.bisect_left bisect bisect_left t x tr=tr-1 if tr==len(t) else tr tr tr-1 if tr==len(t) else tr tr==len(t) tr len(t) len t tr-1 tr 1 tr tl=tr-1 if tr>0 else tr tl tr-1 if tr>0 else tr tr>0 tr 0 tr-1 tr 1 tr def f(i,j):
    #print( abs(x-s[i]),abs(x-t[j]))
    return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i])
#  print(x)
#  print(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
   f return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i]) min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i]) min(abs(x-s[i]),abs(x-t[j])) min abs(x-s[i]) abs x-s[i] x s[i] s i abs(x-t[j]) abs x-t[j] x t[j] t j abs(t[j]-s[i]) abs t[j]-s[i] t[j] t j s[i] s i i i j j ans=min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr)) ans min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr)) min f(sl,tl) f sl tl f(sl,tr) f sl tr f(sr,tl) f sr tl f(sr,tr) f sr tr print(ans) print ans a,b,q=map(int,input().split()) map(int,input().split()) a tr=bisect.bisect_left(t,x) bisect.bisect_left(t,x) tr sr=bisect.bisect_left(s,x) bisect.bisect_left(s,x) sr input=sys.stdin.readline sys.stdin.readline input s=[ int(input()) for _ in range(a)] [ int(input()) for _ in range(a)] s ans=min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr)) min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr)) ans sr=sr-1 if sr==len(s) else sr sr-1 if sr==len(s) else sr sr tr=tr-1 if tr==len(t) else tr tr-1 if tr==len(t) else tr tr b,q=map(int,input().split()) map(int,input().split()) b q=map(int,input().split()) map(int,input().split()) q tl=tr-1 if tr>0 else tr tr-1 if tr>0 else tr tl t=[ int(input()) for _ in range(b)] [ int(input()) for _ in range(b)] t def f(i,j):
    #print( abs(x-s[i]),abs(x-t[j]))
    return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i])
#  print(x)
#  print(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
   def f(i,j):
    #print( abs(x-s[i]),abs(x-t[j]))
    return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i])
#  print(x)
#  print(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
   f sl=sr-1 if sr>0 else sr sr-1 if sr>0 else sr sl x=int(input()) int(input()) x
import sys
import bisect
input=sys.stdin.readline
a,b,q=map(int,input().split())
s=[ int(input()) for _ in range(a)]
t=[ int(input()) for _ in range(b)]
#print(s,end=" s\n")
#print(t,end=" t\n")
for _ in range(q):
  x=int(input())
  sr=bisect.bisect_left(s,x)
  sr=sr-1 if sr==len(s) else sr
  sl=sr-1 if sr>0 else sr 
  tr=bisect.bisect_left(t,x)
  tr=tr-1 if tr==len(t) else tr
  tl=tr-1 if tr>0 else tr
 # print(sl,sr,tl,tr)
  def f(i,j):
    #print( abs(x-s[i]),abs(x-t[j]))
    return min(abs(x-s[i]),abs(x-t[j]))+abs(t[j]-s[i])
#  print(x)
#  print(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
  ans=min(f(sl,tl),f(sl,tr),f(sr,tl),f(sr,tr))
  print(ans)



  


