import bisect
def find_min_fuka_idx(lst, x):
  ok = -1
  ng = len(lst)
  while abs(ok-ng)>1:
    mid = (ok+ng)//2
    if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
  return ng

a,b,q = map(int, input().split())
s = [-10**18]
s_mid = [int(input()) for i in range(a)]
s.extend(s_mid)
s.append(10**18)

t = [-10**18]
t_mid = [int(input()) for i in range(b)]
t.extend(t_mid)
t.append(10**18)

for i in range(q):
  x = int(input())
  si = bisect.bisect_right(s, x)
  tj = bisect.bisect_right(t, x)
  print(min(abs(x-s[si])+abs(s[si]-t[tj]),\
            abs(x-s[si])+abs(s[si]-t[tj-1]),\
           abs(x-t[tj])+abs(t[tj]-s[si]),\
            abs(x-t[tj])+abs(t[tj]-s[si-1]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj-1]),\
           abs(x-t[tj-1])+abs(t[tj-1]-s[si]),\
            abs(x-t[tj-1])+abs(t[tj-1]-s[si-1]))) import bisect bisect def find_min_fuka_idx(lst, x):
  ok = -1
  ng = len(lst)
  while abs(ok-ng)>1:
    mid = (ok+ng)//2
    if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
  return ng find_min_fuka_idx ok = -1 ok -1 ng = len(lst) ng len(lst) len lst while abs(ok-ng)>1:
    mid = (ok+ng)//2
    if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
   abs(ok-ng)>1 abs(ok-ng) abs ok-ng ok ng 1 mid = (ok+ng)//2 mid (ok+ng)//2 ok+ng ok ng 2 if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
   x>=lst[mid] x lst[mid] lst mid ok = mid ok mid ng = mid ng mid return ng ng lst lst x x a,b,q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q s = [-10**18] s [-10**18] -10**18 -10 18 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_mid = [int(input()) for i in range(a)] s_mid [int(input()) for i in range(a)] s.extend(s_mid) s.extend s extend s_mid s.append(10**18) s.append s append 10**18 10 18 t = [-10**18] t [-10**18] -10**18 -10 18 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_mid = [int(input()) for i in range(b)] t_mid [int(input()) for i in range(b)] t.extend(t_mid) t.extend t extend t_mid t.append(10**18) t.append t append 10**18 10 18 for i in range(q):
  x = int(input())
  si = bisect.bisect_right(s, x)
  tj = bisect.bisect_right(t, x)
  print(min(abs(x-s[si])+abs(s[si]-t[tj]),\
            abs(x-s[si])+abs(s[si]-t[tj-1]),\
           abs(x-t[tj])+abs(t[tj]-s[si]),\
            abs(x-t[tj])+abs(t[tj]-s[si-1]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj-1]),\
           abs(x-t[tj-1])+abs(t[tj-1]-s[si]),\
            abs(x-t[tj-1])+abs(t[tj-1]-s[si-1]))) i range(q) range q x = int(input()) x int(input()) int input() input si = bisect.bisect_right(s, x) si bisect.bisect_right(s, x) bisect.bisect_right bisect bisect_right s x tj = bisect.bisect_right(t, x) tj bisect.bisect_right(t, x) bisect.bisect_right bisect bisect_right t x print(min(abs(x-s[si])+abs(s[si]-t[tj]),\
            abs(x-s[si])+abs(s[si]-t[tj-1]),\
           abs(x-t[tj])+abs(t[tj]-s[si]),\
            abs(x-t[tj])+abs(t[tj]-s[si-1]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj-1]),\
           abs(x-t[tj-1])+abs(t[tj-1]-s[si]),\
            abs(x-t[tj-1])+abs(t[tj-1]-s[si-1]))) print min(abs(x-s[si])+abs(s[si]-t[tj]),\
            abs(x-s[si])+abs(s[si]-t[tj-1]),\
           abs(x-t[tj])+abs(t[tj]-s[si]),\
            abs(x-t[tj])+abs(t[tj]-s[si-1]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj-1]),\
           abs(x-t[tj-1])+abs(t[tj-1]-s[si]),\
            abs(x-t[tj-1])+abs(t[tj-1]-s[si-1])) min abs(x-s[si])+abs(s[si]-t[tj]) abs(x-s[si]) abs x-s[si] x s[si] s si abs(s[si]-t[tj]) abs s[si]-t[tj] s[si] s si t[tj] t tj abs(x-s[si])+abs(s[si]-t[tj-1]) abs(x-s[si]) abs x-s[si] x s[si] s si abs(s[si]-t[tj-1]) abs s[si]-t[tj-1] s[si] s si t[tj-1] t tj-1 tj 1 abs(x-t[tj])+abs(t[tj]-s[si]) abs(x-t[tj]) abs x-t[tj] x t[tj] t tj abs(t[tj]-s[si]) abs t[tj]-s[si] t[tj] t tj s[si] s si abs(x-t[tj])+abs(t[tj]-s[si-1]) abs(x-t[tj]) abs x-t[tj] x t[tj] t tj abs(t[tj]-s[si-1]) abs t[tj]-s[si-1] t[tj] t tj s[si-1] s si-1 si 1 abs(x-s[si-1])+abs(s[si-1]-t[tj]) abs(x-s[si-1]) abs x-s[si-1] x s[si-1] s si-1 si 1 abs(s[si-1]-t[tj]) abs s[si-1]-t[tj] s[si-1] s si-1 si 1 t[tj] t tj abs(x-s[si-1])+abs(s[si-1]-t[tj-1]) abs(x-s[si-1]) abs x-s[si-1] x s[si-1] s si-1 si 1 abs(s[si-1]-t[tj-1]) abs s[si-1]-t[tj-1] s[si-1] s si-1 si 1 t[tj-1] t tj-1 tj 1 abs(x-t[tj-1])+abs(t[tj-1]-s[si]) abs(x-t[tj-1]) abs x-t[tj-1] x t[tj-1] t tj-1 tj 1 abs(t[tj-1]-s[si]) abs t[tj-1]-s[si] t[tj-1] t tj-1 tj 1 s[si] s si abs(x-t[tj-1])+abs(t[tj-1]-s[si-1]) abs(x-t[tj-1]) abs x-t[tj-1] x t[tj-1] t tj-1 tj 1 abs(t[tj-1]-s[si-1]) abs t[tj-1]-s[si-1] t[tj-1] t tj-1 tj 1 s[si-1] s si-1 si 1 def find_min_fuka_idx(lst, x):
  ok = -1
  ng = len(lst)
  while abs(ok-ng)>1:
    mid = (ok+ng)//2
    if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
  return ng def find_min_fuka_idx(lst, x):
  ok = -1
  ng = len(lst)
  while abs(ok-ng)>1:
    mid = (ok+ng)//2
    if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
  return ng find_min_fuka_idx t_mid = [int(input()) for i in range(b)] [int(input()) for i in range(b)] t_mid si = bisect.bisect_right(s, x) bisect.bisect_right(s, x) si tj = bisect.bisect_right(t, x) bisect.bisect_right(t, x) tj t = [-10**18] [-10**18] t q = map(int, input().split()) map(int, input().split()) q s_mid = [int(input()) for i in range(a)] [int(input()) for i in range(a)] s_mid a,b,q = map(int, input().split()) map(int, input().split()) a b,q = map(int, input().split()) map(int, input().split()) b s = [-10**18] [-10**18] s x = int(input()) int(input()) x
import bisect
def find_min_fuka_idx(lst, x):
  ok = -1
  ng = len(lst)
  while abs(ok-ng)>1:
    mid = (ok+ng)//2
    if x>=lst[mid]:
      ok = mid
    else:
      ng = mid
  return ng

a,b,q = map(int, input().split())
s = [-10**18]
s_mid = [int(input()) for i in range(a)]
s.extend(s_mid)
s.append(10**18)

t = [-10**18]
t_mid = [int(input()) for i in range(b)]
t.extend(t_mid)
t.append(10**18)

for i in range(q):
  x = int(input())
  si = bisect.bisect_right(s, x)
  tj = bisect.bisect_right(t, x)
  print(min(abs(x-s[si])+abs(s[si]-t[tj]),\
            abs(x-s[si])+abs(s[si]-t[tj-1]),\
           abs(x-t[tj])+abs(t[tj]-s[si]),\
            abs(x-t[tj])+abs(t[tj]-s[si-1]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj]),\
            abs(x-s[si-1])+abs(s[si-1]-t[tj-1]),\
           abs(x-t[tj-1])+abs(t[tj-1]-s[si]),\
            abs(x-t[tj-1])+abs(t[tj-1]-s[si-1])))
