from bisect import bisect

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

for i in range(q):
  x=int(input())
  s_inx=bisect(s,x)
  t_inx=bisect(t,x)

  s_l=s[s_inx-1]
  s_r=s[s_inx]

  t_l=t[t_inx-1]
  t_r=t[t_inx]

  ans=10**18
  for i in [s_l,s_r]:
    for j in [t_l,t_r]:
      d1=abs(i-x)+abs(j-i)
      d2=abs(j-x)+abs(i-j)
      ans=min(ans,d1,d2)

  print(ans) from bisect import 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 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=[-INF]+[int(input()) for i in range(a)]+[INF] s [-INF]+[int(input()) for i in range(a)]+[INF] [-INF]+[int(input()) for i in range(a)] [-INF] -INF INF [int(input()) for i in range(a)] [INF] INF 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=[-INF]+[int(input()) for i in range(b)]+[INF] t [-INF]+[int(input()) for i in range(b)]+[INF] [-INF]+[int(input()) for i in range(b)] [-INF] -INF INF [int(input()) for i in range(b)] [INF] INF for i in range(q):
  x=int(input())
  s_inx=bisect(s,x)
  t_inx=bisect(t,x)

  s_l=s[s_inx-1]
  s_r=s[s_inx]

  t_l=t[t_inx-1]
  t_r=t[t_inx]

  ans=10**18
  for i in [s_l,s_r]:
    for j in [t_l,t_r]:
      d1=abs(i-x)+abs(j-i)
      d2=abs(j-x)+abs(i-j)
      ans=min(ans,d1,d2)

  print(ans) i range(q) range q x=int(input()) x int(input()) int input() input s_inx=bisect(s,x) s_inx bisect(s,x) bisect s x t_inx=bisect(t,x) t_inx bisect(t,x) bisect t x s_l=s[s_inx-1] s_l s[s_inx-1] s s_inx-1 s_inx 1 s_r=s[s_inx] s_r s[s_inx] s s_inx t_l=t[t_inx-1] t_l t[t_inx-1] t t_inx-1 t_inx 1 t_r=t[t_inx] t_r t[t_inx] t t_inx ans=10**18 ans 10**18 10 18 for i in [s_l,s_r]:
    for j in [t_l,t_r]:
      d1=abs(i-x)+abs(j-i)
      d2=abs(j-x)+abs(i-j)
      ans=min(ans,d1,d2)

   i [s_l,s_r] s_l s_r for j in [t_l,t_r]:
      d1=abs(i-x)+abs(j-i)
      d2=abs(j-x)+abs(i-j)
      ans=min(ans,d1,d2)

   j [t_l,t_r] t_l t_r d1=abs(i-x)+abs(j-i) d1 abs(i-x)+abs(j-i) abs(i-x) abs i-x i x abs(j-i) abs j-i j i d2=abs(j-x)+abs(i-j) d2 abs(j-x)+abs(i-j) abs(j-x) abs j-x j x abs(i-j) abs i-j i j ans=min(ans,d1,d2) ans min(ans,d1,d2) min ans d1 d2 print(ans) print ans ans=min(ans,d1,d2) min(ans,d1,d2) ans s_inx=bisect(s,x) bisect(s,x) s_inx s=[-INF]+[int(input()) for i in range(a)]+[INF] [-INF]+[int(input()) for i in range(a)]+[INF] s x=int(input()) int(input()) x t_inx=bisect(t,x) bisect(t,x) t_inx INF=10**18 10**18 INF t_l=t[t_inx-1] t[t_inx-1] t_l s_r=s[s_inx] s[s_inx] s_r t_r=t[t_inx] t[t_inx] t_r d1=abs(i-x)+abs(j-i) abs(i-x)+abs(j-i) d1 d2=abs(j-x)+abs(i-j) abs(j-x)+abs(i-j) d2 a,b,q=map(int,input().split()) map(int,input().split()) a ans=10**18 10**18 ans t=[-INF]+[int(input()) for i in range(b)]+[INF] [-INF]+[int(input()) for i in range(b)]+[INF] t b,q=map(int,input().split()) map(int,input().split()) b q=map(int,input().split()) map(int,input().split()) q s_l=s[s_inx-1] s[s_inx-1] s_l
from bisect import bisect

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

for i in range(q):
  x=int(input())
  s_inx=bisect(s,x)
  t_inx=bisect(t,x)

  s_l=s[s_inx-1]
  s_r=s[s_inx]

  t_l=t[t_inx-1]
  t_r=t[t_inx]

  ans=10**18
  for i in [s_l,s_r]:
    for j in [t_l,t_r]:
      d1=abs(i-x)+abs(j-i)
      d2=abs(j-x)+abs(i-j)
      ans=min(ans,d1,d2)

  print(ans)