from bisect import bisect

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

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]:
      ans=min(ans,abs(i-x)+abs(j-i))

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

  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 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=[-10**18]+[int(input()) for i in range(a)]+[10**18] s [-10**18]+[int(input()) for i in range(a)]+[10**18] [-10**18]+[int(input()) for i in range(a)] [-10**18] -10**18 -10 18 [int(input()) for i in range(a)] [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=[-10**18]+[int(input()) for i in range(b)]+[10**18] t [-10**18]+[int(input()) for i in range(b)]+[10**18] [-10**18]+[int(input()) for i in range(b)] [-10**18] -10**18 -10 18 [int(input()) for i in range(b)] [10**18] 10**18 10 18 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]:
      ans=min(ans,abs(i-x)+abs(j-i))

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

  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]:
      ans=min(ans,abs(i-x)+abs(j-i))

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

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

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

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

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

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]:
      ans=min(ans,abs(i-x)+abs(j-i))

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

  print(ans)