A, B, Q = map(int, input().split())
S = [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18]
T = [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18]
import bisect
for _ in range(Q):
  x = int(input())
  i = bisect.bisect_left(S, x)
  j = bisect.bisect_left(T, x)
  p, q, r, s = S[i-1], S[i], T[j-1], T[j]
  res = 10**18
  for a in (p, q):
    for b in (r, s):
      res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b))
  print(res) 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 = [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18] S [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18] [-10**18]+sorted([int(input()) for _ in range(A)]) [-10**18] -10**18 -10 18 sorted([int(input()) for _ in range(A)]) sorted [int(input()) for _ in range(A)] [10**18] 10**18 10 18 int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T = [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18] T [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18] [-10**18]+sorted([int(input()) for _ in range(B)]) [-10**18] -10**18 -10 18 sorted([int(input()) for _ in range(B)]) sorted [int(input()) for _ in range(B)] [10**18] 10**18 10 18 import bisect bisect for _ in range(Q):
  x = int(input())
  i = bisect.bisect_left(S, x)
  j = bisect.bisect_left(T, x)
  p, q, r, s = S[i-1], S[i], T[j-1], T[j]
  res = 10**18
  for a in (p, q):
    for b in (r, s):
      res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b))
  print(res) _ range(Q) range Q x = int(input()) x int(input()) int input() input i = bisect.bisect_left(S, x) i bisect.bisect_left(S, x) bisect.bisect_left bisect bisect_left S x j = bisect.bisect_left(T, x) j bisect.bisect_left(T, x) bisect.bisect_left bisect bisect_left T x p, q, r, s = S[i-1], S[i], T[j-1], T[j] p S[i-1] S i-1 i 1 q S[i] S i r T[j-1] T j-1 j 1 s T[j] T j res = 10**18 res 10**18 10 18 for a in (p, q):
    for b in (r, s):
      res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b))
   a (p, q) p q for b in (r, s):
      res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b))
   b (r, s) r s res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b)) res min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b)) min res abs(x-a)+abs(a-b) abs(x-a) abs x-a x a abs(a-b) abs a-b a b abs(x-b)+abs(a-b) abs(x-b) abs x-b x b abs(a-b) abs a-b a b print(res) print res x = int(input()) int(input()) x res = 10**18 10**18 res Q = map(int, input().split()) map(int, input().split()) Q p, q, r, s = S[i-1], S[i], T[j-1], T[j] S[i-1] p B, Q = map(int, input().split()) map(int, input().split()) B i = bisect.bisect_left(S, x) bisect.bisect_left(S, x) i res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b)) min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b)) res A, B, Q = map(int, input().split()) map(int, input().split()) A q, r, s = S[i-1], S[i], T[j-1], T[j] S[i] q s = S[i-1], S[i], T[j-1], T[j] T[j] s S = [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18] [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18] S r, s = S[i-1], S[i], T[j-1], T[j] T[j-1] r j = bisect.bisect_left(T, x) bisect.bisect_left(T, x) j T = [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18] [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18] T
A, B, Q = map(int, input().split())
S = [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18]
T = [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18]
import bisect
for _ in range(Q):
  x = int(input())
  i = bisect.bisect_left(S, x)
  j = bisect.bisect_left(T, x)
  p, q, r, s = S[i-1], S[i], T[j-1], T[j]
  res = 10**18
  for a in (p, q):
    for b in (r, s):
      res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b))
  print(res)