import bisect

A, B, Q=map(int, input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]
x=[int(input()) for _ in range(Q)]

st=[0]*A
ts=[0]*B

for i in range(A):
  tmp=bisect.bisect_left(t, s[i])
  if tmp==0:
    st[i]=t[0]-s[i]
  elif tmp==B:
    st[i]=s[i]-t[-1]
  else:
    st[i]=min(s[i]-t[tmp-1], t[tmp]-s[i])
    
for i in range(B):
  tmp=bisect.bisect_left(s, t[i])
  if tmp==0:
    ts[i]=s[0]-t[i]
  elif tmp==A:
    ts[i]=t[i]-s[-1]
  else:
    ts[i]=min(t[i]-s[tmp-1], s[tmp]-t[i])

for i in range(Q):
  cand=set()
  tmp=bisect.bisect_left(s, x[i])
  if tmp>0:
    cand.add(x[i]-s[tmp-1]+st[tmp-1])
  if tmp<A:
    cand.add(s[tmp]-x[i]+st[tmp])
    
  tmp=bisect.bisect_left(t, x[i])
  if tmp>0:
    cand.add(x[i]-t[tmp-1]+ts[tmp-1])
  if tmp<B:
    cand.add(t[tmp]-x[i]+ts[tmp])
    
  print(min(cand)) import bisect bisect 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)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input x=[int(input()) for _ in range(Q)] x [int(input()) for _ in range(Q)] st=[0]*A st [0]*A [0] 0 A ts=[0]*B ts [0]*B [0] 0 B for i in range(A):
  tmp=bisect.bisect_left(t, s[i])
  if tmp==0:
    st[i]=t[0]-s[i]
  elif tmp==B:
    st[i]=s[i]-t[-1]
  else:
    st[i]=min(s[i]-t[tmp-1], t[tmp]-s[i])
     i range(A) range A tmp=bisect.bisect_left(t, s[i]) tmp bisect.bisect_left(t, s[i]) bisect.bisect_left bisect bisect_left t s[i] s i if tmp==0:
    st[i]=t[0]-s[i]
  elif tmp==B:
    st[i]=s[i]-t[-1]
  else:
    st[i]=min(s[i]-t[tmp-1], t[tmp]-s[i])
     tmp==0 tmp 0 st[i]=t[0]-s[i] st[i] st i t[0]-s[i] t[0] t 0 s[i] s i elif tmp==B:
    st[i]=s[i]-t[-1]
   tmp==B tmp B st[i]=s[i]-t[-1] st[i] st i s[i]-t[-1] s[i] s i t[-1] t -1 st[i]=min(s[i]-t[tmp-1], t[tmp]-s[i]) st[i] st i min(s[i]-t[tmp-1], t[tmp]-s[i]) min s[i]-t[tmp-1] s[i] s i t[tmp-1] t tmp-1 tmp 1 t[tmp]-s[i] t[tmp] t tmp s[i] s i for i in range(B):
  tmp=bisect.bisect_left(s, t[i])
  if tmp==0:
    ts[i]=s[0]-t[i]
  elif tmp==A:
    ts[i]=t[i]-s[-1]
  else:
    ts[i]=min(t[i]-s[tmp-1], s[tmp]-t[i]) i range(B) range B tmp=bisect.bisect_left(s, t[i]) tmp bisect.bisect_left(s, t[i]) bisect.bisect_left bisect bisect_left s t[i] t i if tmp==0:
    ts[i]=s[0]-t[i]
  elif tmp==A:
    ts[i]=t[i]-s[-1]
  else:
    ts[i]=min(t[i]-s[tmp-1], s[tmp]-t[i]) tmp==0 tmp 0 ts[i]=s[0]-t[i] ts[i] ts i s[0]-t[i] s[0] s 0 t[i] t i elif tmp==A:
    ts[i]=t[i]-s[-1]
   tmp==A tmp A ts[i]=t[i]-s[-1] ts[i] ts i t[i]-s[-1] t[i] t i s[-1] s -1 ts[i]=min(t[i]-s[tmp-1], s[tmp]-t[i]) ts[i] ts i min(t[i]-s[tmp-1], s[tmp]-t[i]) min t[i]-s[tmp-1] t[i] t i s[tmp-1] s tmp-1 tmp 1 s[tmp]-t[i] s[tmp] s tmp t[i] t i for i in range(Q):
  cand=set()
  tmp=bisect.bisect_left(s, x[i])
  if tmp>0:
    cand.add(x[i]-s[tmp-1]+st[tmp-1])
  if tmp<A:
    cand.add(s[tmp]-x[i]+st[tmp])
    
  tmp=bisect.bisect_left(t, x[i])
  if tmp>0:
    cand.add(x[i]-t[tmp-1]+ts[tmp-1])
  if tmp<B:
    cand.add(t[tmp]-x[i]+ts[tmp])
    
  print(min(cand)) i range(Q) range Q cand=set() cand set() set tmp=bisect.bisect_left(s, x[i]) tmp bisect.bisect_left(s, x[i]) bisect.bisect_left bisect bisect_left s x[i] x i if tmp>0:
    cand.add(x[i]-s[tmp-1]+st[tmp-1])
   tmp>0 tmp 0 cand.add(x[i]-s[tmp-1]+st[tmp-1]) cand.add cand add x[i]-s[tmp-1]+st[tmp-1] x[i]-s[tmp-1] x[i] x i s[tmp-1] s tmp-1 tmp 1 st[tmp-1] st tmp-1 tmp 1 if tmp<A:
    cand.add(s[tmp]-x[i]+st[tmp])
    
   tmp<A tmp A cand.add(s[tmp]-x[i]+st[tmp]) cand.add cand add s[tmp]-x[i]+st[tmp] s[tmp]-x[i] s[tmp] s tmp x[i] x i st[tmp] st tmp tmp=bisect.bisect_left(t, x[i]) tmp bisect.bisect_left(t, x[i]) bisect.bisect_left bisect bisect_left t x[i] x i if tmp>0:
    cand.add(x[i]-t[tmp-1]+ts[tmp-1])
   tmp>0 tmp 0 cand.add(x[i]-t[tmp-1]+ts[tmp-1]) cand.add cand add x[i]-t[tmp-1]+ts[tmp-1] x[i]-t[tmp-1] x[i] x i t[tmp-1] t tmp-1 tmp 1 ts[tmp-1] ts tmp-1 tmp 1 if tmp<B:
    cand.add(t[tmp]-x[i]+ts[tmp])
    
   tmp<B tmp B cand.add(t[tmp]-x[i]+ts[tmp]) cand.add cand add t[tmp]-x[i]+ts[tmp] t[tmp]-x[i] t[tmp] t tmp x[i] x i ts[tmp] ts tmp print(min(cand)) print min(cand) min cand A, B, Q=map(int, input().split()) map(int, input().split()) A s=[int(input()) for _ in range(A)] [int(input()) for _ in range(A)] s tmp=bisect.bisect_left(s, t[i]) bisect.bisect_left(s, t[i]) tmp cand=set() set() cand x=[int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] x ts=[0]*B [0]*B ts B, Q=map(int, input().split()) map(int, input().split()) B Q=map(int, input().split()) map(int, input().split()) Q st=[0]*A [0]*A st tmp=bisect.bisect_left(t, x[i]) bisect.bisect_left(t, x[i]) tmp tmp=bisect.bisect_left(t, s[i]) bisect.bisect_left(t, s[i]) tmp t=[int(input()) for _ in range(B)] [int(input()) for _ in range(B)] t tmp=bisect.bisect_left(s, x[i]) bisect.bisect_left(s, x[i]) tmp
import bisect

A, B, Q=map(int, input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]
x=[int(input()) for _ in range(Q)]

st=[0]*A
ts=[0]*B

for i in range(A):
  tmp=bisect.bisect_left(t, s[i])
  if tmp==0:
    st[i]=t[0]-s[i]
  elif tmp==B:
    st[i]=s[i]-t[-1]
  else:
    st[i]=min(s[i]-t[tmp-1], t[tmp]-s[i])
    
for i in range(B):
  tmp=bisect.bisect_left(s, t[i])
  if tmp==0:
    ts[i]=s[0]-t[i]
  elif tmp==A:
    ts[i]=t[i]-s[-1]
  else:
    ts[i]=min(t[i]-s[tmp-1], s[tmp]-t[i])

for i in range(Q):
  cand=set()
  tmp=bisect.bisect_left(s, x[i])
  if tmp>0:
    cand.add(x[i]-s[tmp-1]+st[tmp-1])
  if tmp<A:
    cand.add(s[tmp]-x[i]+st[tmp])
    
  tmp=bisect.bisect_left(t, x[i])
  if tmp>0:
    cand.add(x[i]-t[tmp-1]+ts[tmp-1])
  if tmp<B:
    cand.add(t[tmp]-x[i]+ts[tmp])
    
  print(min(cand))