from bisect import *
A,B,Q = map(int,input().split())
inf = float("inf")
S = [-inf]+[int(input()) for a in range(A)]+[inf]
T = [-inf]+[int(input()) for b in range(B)]+[inf]
X = [int(input()) for q in range(Q)]

for x in X:
  si = bisect(S,x)
  ti = bisect(T,x)
  d1 = x-S[si-1]
  d2 = S[si]-x
  d3 = x-T[ti-1]
  d4 = T[ti]-x
  print(min(2*d1+d4,d1+d4*2,2*d2+d3,d2+d3*2,max(d1,d3),max(d2,d4))) from bisect import * A,B,Q = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q inf = float("inf") inf float("inf") float "inf" int(input()) for a in range(A) for a in range(A) a range(A) range A for a in range(A) int(input()) int input() input S = [-inf]+[int(input()) for a in range(A)]+[inf] S [-inf]+[int(input()) for a in range(A)]+[inf] [-inf]+[int(input()) for a in range(A)] [-inf] -inf inf [int(input()) for a in range(A)] [inf] inf int(input()) for b in range(B) for b in range(B) b range(B) range B for b in range(B) int(input()) int input() input T = [-inf]+[int(input()) for b in range(B)]+[inf] T [-inf]+[int(input()) for b in range(B)]+[inf] [-inf]+[int(input()) for b in range(B)] [-inf] -inf inf [int(input()) for b in range(B)] [inf] inf int(input()) for q in range(Q) for q in range(Q) q range(Q) range Q for q in range(Q) int(input()) int input() input X = [int(input()) for q in range(Q)] X [int(input()) for q in range(Q)] for x in X:
  si = bisect(S,x)
  ti = bisect(T,x)
  d1 = x-S[si-1]
  d2 = S[si]-x
  d3 = x-T[ti-1]
  d4 = T[ti]-x
  print(min(2*d1+d4,d1+d4*2,2*d2+d3,d2+d3*2,max(d1,d3),max(d2,d4))) x X si = bisect(S,x) si bisect(S,x) bisect S x ti = bisect(T,x) ti bisect(T,x) bisect T x d1 = x-S[si-1] d1 x-S[si-1] x S[si-1] S si-1 si 1 d2 = S[si]-x d2 S[si]-x S[si] S si x d3 = x-T[ti-1] d3 x-T[ti-1] x T[ti-1] T ti-1 ti 1 d4 = T[ti]-x d4 T[ti]-x T[ti] T ti x print(min(2*d1+d4,d1+d4*2,2*d2+d3,d2+d3*2,max(d1,d3),max(d2,d4))) print min(2*d1+d4,d1+d4*2,2*d2+d3,d2+d3*2,max(d1,d3),max(d2,d4)) min 2*d1+d4 2*d1 2 d1 d4 d1+d4*2 d1 d4*2 d4 2 2*d2+d3 2*d2 2 d2 d3 d2+d3*2 d2 d3*2 d3 2 max(d1,d3) max d1 d3 max(d2,d4) max d2 d4 d2 = S[si]-x S[si]-x d2 T = [-inf]+[int(input()) for b in range(B)]+[inf] [-inf]+[int(input()) for b in range(B)]+[inf] T A,B,Q = map(int,input().split()) map(int,input().split()) A d4 = T[ti]-x T[ti]-x d4 d3 = x-T[ti-1] x-T[ti-1] d3 B,Q = map(int,input().split()) map(int,input().split()) B S = [-inf]+[int(input()) for a in range(A)]+[inf] [-inf]+[int(input()) for a in range(A)]+[inf] S si = bisect(S,x) bisect(S,x) si d1 = x-S[si-1] x-S[si-1] d1 Q = map(int,input().split()) map(int,input().split()) Q ti = bisect(T,x) bisect(T,x) ti X = [int(input()) for q in range(Q)] [int(input()) for q in range(Q)] X inf = float("inf") float("inf") inf
from bisect import *
A,B,Q = map(int,input().split())
inf = float("inf")
S = [-inf]+[int(input()) for a in range(A)]+[inf]
T = [-inf]+[int(input()) for b in range(B)]+[inf]
X = [int(input()) for q in range(Q)]

for x in X:
  si = bisect(S,x)
  ti = bisect(T,x)
  d1 = x-S[si-1]
  d2 = S[si]-x
  d3 = x-T[ti-1]
  d4 = T[ti]-x
  print(min(2*d1+d4,d1+d4*2,2*d2+d3,d2+d3*2,max(d1,d3),max(d2,d4)))