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