import bisect
a,b,q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]

for k in range(q):
  x=int(input())
  i=bisect.bisect_right(s,x)
  j=bisect.bisect_right(t,x)
  d=INF
  for S in [s[i-1],s[i]]:
    for T in [t[j-1],t[j]]:
      d1=abs(S-x)+abs(S-T)
      d2=abs(T-x)+abs(S-T)
      d=min(d,d1,d2)
  print(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 INF=10**18 INF 10**18 10 18 int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s=[-INF]+[int(input()) for _ in range(a)]+[INF] s [-INF]+[int(input()) for _ in range(a)]+[INF] [-INF]+[int(input()) for _ in range(a)] [-INF] -INF INF [int(input()) for _ in range(a)] [INF] INF int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t=[-INF]+[int(input()) for _ in range(b)]+[INF] t [-INF]+[int(input()) for _ in range(b)]+[INF] [-INF]+[int(input()) for _ in range(b)] [-INF] -INF INF [int(input()) for _ in range(b)] [INF] INF for k in range(q):
  x=int(input())
  i=bisect.bisect_right(s,x)
  j=bisect.bisect_right(t,x)
  d=INF
  for S in [s[i-1],s[i]]:
    for T in [t[j-1],t[j]]:
      d1=abs(S-x)+abs(S-T)
      d2=abs(T-x)+abs(S-T)
      d=min(d,d1,d2)
  print(d) k range(q) range q x=int(input()) x int(input()) int input() input i=bisect.bisect_right(s,x) i bisect.bisect_right(s,x) bisect.bisect_right bisect bisect_right s x j=bisect.bisect_right(t,x) j bisect.bisect_right(t,x) bisect.bisect_right bisect bisect_right t x d=INF d INF for S in [s[i-1],s[i]]:
    for T in [t[j-1],t[j]]:
      d1=abs(S-x)+abs(S-T)
      d2=abs(T-x)+abs(S-T)
      d=min(d,d1,d2)
   S [s[i-1],s[i]] s[i-1] s i-1 i 1 s[i] s i for T in [t[j-1],t[j]]:
      d1=abs(S-x)+abs(S-T)
      d2=abs(T-x)+abs(S-T)
      d=min(d,d1,d2)
   T [t[j-1],t[j]] t[j-1] t j-1 j 1 t[j] t j d1=abs(S-x)+abs(S-T) d1 abs(S-x)+abs(S-T) abs(S-x) abs S-x S x abs(S-T) abs S-T S T d2=abs(T-x)+abs(S-T) d2 abs(T-x)+abs(S-T) abs(T-x) abs T-x T x abs(S-T) abs S-T S T d=min(d,d1,d2) d min(d,d1,d2) min d d1 d2 print(d) print d d2=abs(T-x)+abs(S-T) abs(T-x)+abs(S-T) d2 d=INF INF d i=bisect.bisect_right(s,x) bisect.bisect_right(s,x) i a,b,q=map(int,input().split()) map(int,input().split()) a j=bisect.bisect_right(t,x) bisect.bisect_right(t,x) j q=map(int,input().split()) map(int,input().split()) q INF=10**18 10**18 INF x=int(input()) int(input()) x d=min(d,d1,d2) min(d,d1,d2) d t=[-INF]+[int(input()) for _ in range(b)]+[INF] [-INF]+[int(input()) for _ in range(b)]+[INF] t s=[-INF]+[int(input()) for _ in range(a)]+[INF] [-INF]+[int(input()) for _ in range(a)]+[INF] s d1=abs(S-x)+abs(S-T) abs(S-x)+abs(S-T) d1 b,q=map(int,input().split()) map(int,input().split()) b
import bisect
a,b,q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]

for k in range(q):
  x=int(input())
  i=bisect.bisect_right(s,x)
  j=bisect.bisect_right(t,x)
  d=INF
  for S in [s[i-1],s[i]]:
    for T in [t[j-1],t[j]]:
      d1=abs(S-x)+abs(S-T)
      d2=abs(T-x)+abs(S-T)
      d=min(d,d1,d2)
  print(d)

