import bisect
a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
for i in range(q):
  x=int(input())
  idxS=bisect.bisect_left(s,x)
  idxT=bisect.bisect_left(t,x)
  d=[]
  if idxS<a and idxT<b:
    d.append(max(s[idxS]-x,t[idxT]-x))
  if 1<=idxS and 1<=idxT:
    d.append(max(x-s[idxS-1],x-t[idxT-1]))
  if 1<=idxS and idxT<b:
    d.append((t[idxT]-x)*2+x-s[idxS-1])
  if 1<=idxT and idxS<a:
    d.append((s[idxS]-x)*2+x-t[idxT-1])
  if idxT<b and 1<=idxS:
    d.append((x-s[idxS-1])*2+t[idxT]-x)
  if idxS<a and 1<=idxT:
    d.append((x-t[idxT-1])*2+s[idxS]-x)
  print(min(d)) 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 i in range(a) for i in range(a) i range(a) range a for i in range(a) int(input()) int input() input s=[int(input()) for i in range(a)] s [int(input()) for i in range(a)] int(input()) for i in range(b) for i in range(b) i range(b) range b for i in range(b) int(input()) int input() input t=[int(input()) for i in range(b)] t [int(input()) for i in range(b)] for i in range(q):
  x=int(input())
  idxS=bisect.bisect_left(s,x)
  idxT=bisect.bisect_left(t,x)
  d=[]
  if idxS<a and idxT<b:
    d.append(max(s[idxS]-x,t[idxT]-x))
  if 1<=idxS and 1<=idxT:
    d.append(max(x-s[idxS-1],x-t[idxT-1]))
  if 1<=idxS and idxT<b:
    d.append((t[idxT]-x)*2+x-s[idxS-1])
  if 1<=idxT and idxS<a:
    d.append((s[idxS]-x)*2+x-t[idxT-1])
  if idxT<b and 1<=idxS:
    d.append((x-s[idxS-1])*2+t[idxT]-x)
  if idxS<a and 1<=idxT:
    d.append((x-t[idxT-1])*2+s[idxS]-x)
  print(min(d)) i range(q) range q x=int(input()) x int(input()) int input() input idxS=bisect.bisect_left(s,x) idxS bisect.bisect_left(s,x) bisect.bisect_left bisect bisect_left s x idxT=bisect.bisect_left(t,x) idxT bisect.bisect_left(t,x) bisect.bisect_left bisect bisect_left t x d=[] d [] if idxS<a and idxT<b:
    d.append(max(s[idxS]-x,t[idxT]-x))
   idxS<a and idxT<b idxS<a idxS a idxT<b idxT b d.append(max(s[idxS]-x,t[idxT]-x)) d.append d append max(s[idxS]-x,t[idxT]-x) max s[idxS]-x s[idxS] s idxS x t[idxT]-x t[idxT] t idxT x if 1<=idxS and 1<=idxT:
    d.append(max(x-s[idxS-1],x-t[idxT-1]))
   1<=idxS and 1<=idxT 1<=idxS 1 idxS 1<=idxT 1 idxT d.append(max(x-s[idxS-1],x-t[idxT-1])) d.append d append max(x-s[idxS-1],x-t[idxT-1]) max x-s[idxS-1] x s[idxS-1] s idxS-1 idxS 1 x-t[idxT-1] x t[idxT-1] t idxT-1 idxT 1 if 1<=idxS and idxT<b:
    d.append((t[idxT]-x)*2+x-s[idxS-1])
   1<=idxS and idxT<b 1<=idxS 1 idxS idxT<b idxT b d.append((t[idxT]-x)*2+x-s[idxS-1]) d.append d append (t[idxT]-x)*2+x-s[idxS-1] (t[idxT]-x)*2+x (t[idxT]-x)*2 t[idxT]-x t[idxT] t idxT x 2 x s[idxS-1] s idxS-1 idxS 1 if 1<=idxT and idxS<a:
    d.append((s[idxS]-x)*2+x-t[idxT-1])
   1<=idxT and idxS<a 1<=idxT 1 idxT idxS<a idxS a d.append((s[idxS]-x)*2+x-t[idxT-1]) d.append d append (s[idxS]-x)*2+x-t[idxT-1] (s[idxS]-x)*2+x (s[idxS]-x)*2 s[idxS]-x s[idxS] s idxS x 2 x t[idxT-1] t idxT-1 idxT 1 if idxT<b and 1<=idxS:
    d.append((x-s[idxS-1])*2+t[idxT]-x)
   idxT<b and 1<=idxS idxT<b idxT b 1<=idxS 1 idxS d.append((x-s[idxS-1])*2+t[idxT]-x) d.append d append (x-s[idxS-1])*2+t[idxT]-x (x-s[idxS-1])*2+t[idxT] (x-s[idxS-1])*2 x-s[idxS-1] x s[idxS-1] s idxS-1 idxS 1 2 t[idxT] t idxT x if idxS<a and 1<=idxT:
    d.append((x-t[idxT-1])*2+s[idxS]-x)
   idxS<a and 1<=idxT idxS<a idxS a 1<=idxT 1 idxT d.append((x-t[idxT-1])*2+s[idxS]-x) d.append d append (x-t[idxT-1])*2+s[idxS]-x (x-t[idxT-1])*2+s[idxS] (x-t[idxT-1])*2 x-t[idxT-1] x t[idxT-1] t idxT-1 idxT 1 2 s[idxS] s idxS x print(min(d)) print min(d) min d d=[] [] d s=[int(input()) for i in range(a)] [int(input()) for i in range(a)] s q=map(int,input().split()) map(int,input().split()) q t=[int(input()) for i in range(b)] [int(input()) for i in range(b)] t b,q=map(int,input().split()) map(int,input().split()) b idxS=bisect.bisect_left(s,x) bisect.bisect_left(s,x) idxS a,b,q=map(int,input().split()) map(int,input().split()) a x=int(input()) int(input()) x idxT=bisect.bisect_left(t,x) bisect.bisect_left(t,x) idxT
import bisect
a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
for i in range(q):
  x=int(input())
  idxS=bisect.bisect_left(s,x)
  idxT=bisect.bisect_left(t,x)
  d=[]
  if idxS<a and idxT<b:
    d.append(max(s[idxS]-x,t[idxT]-x))
  if 1<=idxS and 1<=idxT:
    d.append(max(x-s[idxS-1],x-t[idxT-1]))
  if 1<=idxS and idxT<b:
    d.append((t[idxT]-x)*2+x-s[idxS-1])
  if 1<=idxT and idxS<a:
    d.append((s[idxS]-x)*2+x-t[idxT-1])
  if idxT<b and 1<=idxS:
    d.append((x-s[idxS-1])*2+t[idxT]-x)
  if idxS<a and 1<=idxT:
    d.append((x-t[idxT-1])*2+s[idxS]-x)
  print(min(d))