from bisect import*
a,b,q=map(int,input().split())
s=[-10**18]+[int(input()) for _ in range(a)]+[10**18]
t=[-10**18]+[int(input()) for _ in range(b)]+[10**18]
for _ in range(q):
  i=int(input())
  si=bisect_left(s,i)
  ti=bisect_left(t,i)
  print(min(max(s[si],t[ti])-i,i-min(t[ti-1],s[si-1]),
            2*t[ti]-s[si-1]-i,2*s[si]-t[ti-1]-i,
            i+t[ti]-2*s[si-1],i+s[si]-2*t[ti-1])) from bisect import* a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s=[-10**18]+[int(input()) for _ in range(a)]+[10**18] s [-10**18]+[int(input()) for _ in range(a)]+[10**18] [-10**18]+[int(input()) for _ in range(a)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(a)] [10**18] 10**18 10 18 int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t=[-10**18]+[int(input()) for _ in range(b)]+[10**18] t [-10**18]+[int(input()) for _ in range(b)]+[10**18] [-10**18]+[int(input()) for _ in range(b)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(b)] [10**18] 10**18 10 18 for _ in range(q):
  i=int(input())
  si=bisect_left(s,i)
  ti=bisect_left(t,i)
  print(min(max(s[si],t[ti])-i,i-min(t[ti-1],s[si-1]),
            2*t[ti]-s[si-1]-i,2*s[si]-t[ti-1]-i,
            i+t[ti]-2*s[si-1],i+s[si]-2*t[ti-1])) _ range(q) range q i=int(input()) i int(input()) int input() input si=bisect_left(s,i) si bisect_left(s,i) bisect_left s i ti=bisect_left(t,i) ti bisect_left(t,i) bisect_left t i print(min(max(s[si],t[ti])-i,i-min(t[ti-1],s[si-1]),
            2*t[ti]-s[si-1]-i,2*s[si]-t[ti-1]-i,
            i+t[ti]-2*s[si-1],i+s[si]-2*t[ti-1])) print min(max(s[si],t[ti])-i,i-min(t[ti-1],s[si-1]),
            2*t[ti]-s[si-1]-i,2*s[si]-t[ti-1]-i,
            i+t[ti]-2*s[si-1],i+s[si]-2*t[ti-1]) min max(s[si],t[ti])-i max(s[si],t[ti]) max s[si] s si t[ti] t ti i i-min(t[ti-1],s[si-1]) i min(t[ti-1],s[si-1]) min t[ti-1] t ti-1 ti 1 s[si-1] s si-1 si 1 2*t[ti]-s[si-1]-i 2*t[ti]-s[si-1] 2*t[ti] 2 t[ti] t ti s[si-1] s si-1 si 1 i 2*s[si]-t[ti-1]-i 2*s[si]-t[ti-1] 2*s[si] 2 s[si] s si t[ti-1] t ti-1 ti 1 i i+t[ti]-2*s[si-1] i+t[ti] i t[ti] t ti 2*s[si-1] 2 s[si-1] s si-1 si 1 i+s[si]-2*t[ti-1] i+s[si] i s[si] s si 2*t[ti-1] 2 t[ti-1] t ti-1 ti 1 q=map(int,input().split()) map(int,input().split()) q s=[-10**18]+[int(input()) for _ in range(a)]+[10**18] [-10**18]+[int(input()) for _ in range(a)]+[10**18] s i=int(input()) int(input()) i b,q=map(int,input().split()) map(int,input().split()) b a,b,q=map(int,input().split()) map(int,input().split()) a t=[-10**18]+[int(input()) for _ in range(b)]+[10**18] [-10**18]+[int(input()) for _ in range(b)]+[10**18] t si=bisect_left(s,i) bisect_left(s,i) si ti=bisect_left(t,i) bisect_left(t,i) ti
from bisect import*
a,b,q=map(int,input().split())
s=[-10**18]+[int(input()) for _ in range(a)]+[10**18]
t=[-10**18]+[int(input()) for _ in range(b)]+[10**18]
for _ in range(q):
  i=int(input())
  si=bisect_left(s,i)
  ti=bisect_left(t,i)
  print(min(max(s[si],t[ti])-i,i-min(t[ti-1],s[si-1]),
            2*t[ti]-s[si-1]-i,2*s[si]-t[ti-1]-i,
            i+t[ti]-2*s[si-1],i+s[si]-2*t[ti-1]))