import bisect
A, B, Q = map(int,input().split())
INF = 10**13

s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]

def get(x, s, t, ans_list):
  l_s = bisect.bisect_left(s, x)-1
  r_s = bisect.bisect_left(s, x)-1 + 1
  if l_s >= 0:
    y = s[l_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  if r_s <= len(s)-1:
    y = s[r_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
  
for _ in range(Q):
  ans_list = []
  x = int(input())
  get(x, s, t, ans_list)
  get(x, t, s, ans_list)
  #print(x, ans_list)
  print(min(ans_list)) import bisect bisect A, B, Q = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q INF = 10**13 INF 10**13 10 13 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)] def get(x, s, t, ans_list):
  l_s = bisect.bisect_left(s, x)-1
  r_s = bisect.bisect_left(s, x)-1 + 1
  if l_s >= 0:
    y = s[l_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  if r_s <= len(s)-1:
    y = s[r_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
   get l_s = bisect.bisect_left(s, x)-1 l_s bisect.bisect_left(s, x)-1 bisect.bisect_left(s, x) bisect.bisect_left bisect bisect_left s x 1 r_s = bisect.bisect_left(s, x)-1 + 1 r_s bisect.bisect_left(s, x)-1 + 1 bisect.bisect_left(s, x)-1 bisect.bisect_left(s, x) bisect.bisect_left bisect bisect_left s x 1 1 if l_s >= 0:
    y = s[l_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
   l_s >= 0 l_s 0 y = s[l_s] y s[l_s] s l_s l_t = bisect.bisect_left(t, y)-1 l_t bisect.bisect_left(t, y)-1 bisect.bisect_left(t, y) bisect.bisect_left bisect bisect_left t y 1 r_t = bisect.bisect_left(t, y)-1 + 1 r_t bisect.bisect_left(t, y)-1 + 1 bisect.bisect_left(t, y)-1 bisect.bisect_left(t, y) bisect.bisect_left bisect bisect_left t y 1 1 if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
     l_t >= 0 l_t 0 ans_list.append(abs(x-y) + abs(y-t[l_t])) ans_list.append ans_list append abs(x-y) + abs(y-t[l_t]) abs(x-y) abs x-y x y abs(y-t[l_t]) abs y-t[l_t] y t[l_t] t l_t if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
   r_t <= len(t)-1 r_t len(t)-1 len(t) len t 1 ans_list.append(abs(x-y) + abs(y-t[r_t])) ans_list.append ans_list append abs(x-y) + abs(y-t[r_t]) abs(x-y) abs x-y x y abs(y-t[r_t]) abs y-t[r_t] y t[r_t] t r_t if r_s <= len(s)-1:
    y = s[r_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
   r_s <= len(s)-1 r_s len(s)-1 len(s) len s 1 y = s[r_s] y s[r_s] s r_s l_t = bisect.bisect_left(t, y)-1 l_t bisect.bisect_left(t, y)-1 bisect.bisect_left(t, y) bisect.bisect_left bisect bisect_left t y 1 r_t = bisect.bisect_left(t, y)-1 + 1 r_t bisect.bisect_left(t, y)-1 + 1 bisect.bisect_left(t, y)-1 bisect.bisect_left(t, y) bisect.bisect_left bisect bisect_left t y 1 1 if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
     l_t >= 0 l_t 0 ans_list.append(abs(x-y) + abs(y-t[l_t])) ans_list.append ans_list append abs(x-y) + abs(y-t[l_t]) abs(x-y) abs x-y x y abs(y-t[l_t]) abs y-t[l_t] y t[l_t] t l_t if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
   r_t <= len(t)-1 r_t len(t)-1 len(t) len t 1 ans_list.append(abs(x-y) + abs(y-t[r_t])) ans_list.append ans_list append abs(x-y) + abs(y-t[r_t]) abs(x-y) abs x-y x y abs(y-t[r_t]) abs y-t[r_t] y t[r_t] t r_t x x s s t t ans_list ans_list for _ in range(Q):
  ans_list = []
  x = int(input())
  get(x, s, t, ans_list)
  get(x, t, s, ans_list)
  #print(x, ans_list)
  print(min(ans_list)) _ range(Q) range Q ans_list = [] ans_list [] x = int(input()) x int(input()) int input() input get(x, s, t, ans_list) get x s t ans_list get(x, t, s, ans_list) get x t s ans_list print(min(ans_list)) print min(ans_list) min ans_list def get(x, s, t, ans_list):
  l_s = bisect.bisect_left(s, x)-1
  r_s = bisect.bisect_left(s, x)-1 + 1
  if l_s >= 0:
    y = s[l_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  if r_s <= len(s)-1:
    y = s[r_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
   def get(x, s, t, ans_list):
  l_s = bisect.bisect_left(s, x)-1
  r_s = bisect.bisect_left(s, x)-1 + 1
  if l_s >= 0:
    y = s[l_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  if r_s <= len(s)-1:
    y = s[r_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
   get ans_list = [] [] ans_list x = int(input()) int(input()) x s = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] s B, Q = map(int,input().split()) map(int,input().split()) B t = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] t A, B, Q = map(int,input().split()) map(int,input().split()) A Q = map(int,input().split()) map(int,input().split()) Q INF = 10**13 10**13 INF
import bisect
A, B, Q = map(int,input().split())
INF = 10**13

s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]

def get(x, s, t, ans_list):
  l_s = bisect.bisect_left(s, x)-1
  r_s = bisect.bisect_left(s, x)-1 + 1
  if l_s >= 0:
    y = s[l_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  if r_s <= len(s)-1:
    y = s[r_s]
    l_t = bisect.bisect_left(t, y)-1
    r_t = bisect.bisect_left(t, y)-1 + 1
    if l_t >= 0:
      ans_list.append(abs(x-y) + abs(y-t[l_t]))
    if r_t <= len(t)-1:
      ans_list.append(abs(x-y) + abs(y-t[r_t]))
  
  
for _ in range(Q):
  ans_list = []
  x = int(input())
  get(x, s, t, ans_list)
  get(x, t, s, ans_list)
  #print(x, ans_list)
  print(min(ans_list))
