A,B,Q=map(int, input().split())
from bisect import bisect_left

S=[]
for i in range(A):
    s=int(input())
    S.append(s)
T=[]
for i in range(B):
    t=int(input())
    T.append(t)

for i in range(Q):
    x=int(input())
    sidx=bisect_left(S, x)
    tidx=bisect_left(T, x)
    if 0<=sidx<A and 0<=tidx<B:
        a1=max(S[sidx], T[tidx])-x
    else:
        a1=float("INF")
    if 0<=sidx-1<A and 0<=tidx-1<B:
        a2=max(x-S[sidx-1], x-T[tidx-1])
    else:
        a2=float("INF")
    if 0<=sidx<A and 0<=tidx-1<B:
        a3=S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1])
    else:
        a3=float("INF")
    if 0<=sidx-1<A and 0<=tidx<B:
        a4=T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1])
    else:
        a4=float("INF")
    #print(a1,a2,a3,a4)
    ans=min(a1,a2,a3,a4)
    print(ans) A,B,Q=map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q from bisect import bisect_left S=[] S [] for i in range(A):
    s=int(input())
    S.append(s) i range(A) range A s=int(input()) s int(input()) int input() input S.append(s) S.append S append s T=[] T [] for i in range(B):
    t=int(input())
    T.append(t) i range(B) range B t=int(input()) t int(input()) int input() input T.append(t) T.append T append t for i in range(Q):
    x=int(input())
    sidx=bisect_left(S, x)
    tidx=bisect_left(T, x)
    if 0<=sidx<A and 0<=tidx<B:
        a1=max(S[sidx], T[tidx])-x
    else:
        a1=float("INF")
    if 0<=sidx-1<A and 0<=tidx-1<B:
        a2=max(x-S[sidx-1], x-T[tidx-1])
    else:
        a2=float("INF")
    if 0<=sidx<A and 0<=tidx-1<B:
        a3=S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1])
    else:
        a3=float("INF")
    if 0<=sidx-1<A and 0<=tidx<B:
        a4=T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1])
    else:
        a4=float("INF")
    #print(a1,a2,a3,a4)
    ans=min(a1,a2,a3,a4)
    print(ans) i range(Q) range Q x=int(input()) x int(input()) int input() input sidx=bisect_left(S, x) sidx bisect_left(S, x) bisect_left S x tidx=bisect_left(T, x) tidx bisect_left(T, x) bisect_left T x if 0<=sidx<A and 0<=tidx<B:
        a1=max(S[sidx], T[tidx])-x
    else:
        a1=float("INF")
     0<=sidx<A and 0<=tidx<B 0<=sidx<A 0<=sidx 0 sidx A 0<=tidx<B 0<=tidx 0 tidx B a1=max(S[sidx], T[tidx])-x a1 max(S[sidx], T[tidx])-x max(S[sidx], T[tidx]) max S[sidx] S sidx T[tidx] T tidx x a1=float("INF") a1 float("INF") float "INF" if 0<=sidx-1<A and 0<=tidx-1<B:
        a2=max(x-S[sidx-1], x-T[tidx-1])
    else:
        a2=float("INF")
     0<=sidx-1<A and 0<=tidx-1<B 0<=sidx-1<A 0<=sidx-1 0 sidx-1 sidx 1 A 0<=tidx-1<B 0<=tidx-1 0 tidx-1 tidx 1 B a2=max(x-S[sidx-1], x-T[tidx-1]) a2 max(x-S[sidx-1], x-T[tidx-1]) max x-S[sidx-1] x S[sidx-1] S sidx-1 sidx 1 x-T[tidx-1] x T[tidx-1] T tidx-1 tidx 1 a2=float("INF") a2 float("INF") float "INF" if 0<=sidx<A and 0<=tidx-1<B:
        a3=S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1])
    else:
        a3=float("INF")
     0<=sidx<A and 0<=tidx-1<B 0<=sidx<A 0<=sidx 0 sidx A 0<=tidx-1<B 0<=tidx-1 0 tidx-1 tidx 1 B a3=S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1]) a3 S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1]) S[sidx]-T[tidx-1] S[sidx] S sidx T[tidx-1] T tidx-1 tidx 1 min(S[sidx]-x, x-T[tidx-1]) min S[sidx]-x S[sidx] S sidx x x-T[tidx-1] x T[tidx-1] T tidx-1 tidx 1 a3=float("INF") a3 float("INF") float "INF" if 0<=sidx-1<A and 0<=tidx<B:
        a4=T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1])
    else:
        a4=float("INF")
    #print(a1,a2,a3,a4)
     0<=sidx-1<A and 0<=tidx<B 0<=sidx-1<A 0<=sidx-1 0 sidx-1 sidx 1 A 0<=tidx<B 0<=tidx 0 tidx B a4=T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1]) a4 T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1]) T[tidx]-S[sidx-1] T[tidx] T tidx S[sidx-1] S sidx-1 sidx 1 min(T[tidx]-x, x-S[sidx-1]) min T[tidx]-x T[tidx] T tidx x x-S[sidx-1] x S[sidx-1] S sidx-1 sidx 1 a4=float("INF") a4 float("INF") float "INF" ans=min(a1,a2,a3,a4) ans min(a1,a2,a3,a4) min a1 a2 a3 a4 print(ans) print ans T=[] [] T a4=float("INF") float("INF") a4 a1=float("INF") float("INF") a1 s=int(input()) int(input()) s t=int(input()) int(input()) t tidx=bisect_left(T, x) bisect_left(T, x) tidx a1=max(S[sidx], T[tidx])-x max(S[sidx], T[tidx])-x a1 A,B,Q=map(int, input().split()) map(int, input().split()) A Q=map(int, input().split()) map(int, input().split()) Q a4=T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1]) T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1]) a4 B,Q=map(int, input().split()) map(int, input().split()) B x=int(input()) int(input()) x a2=max(x-S[sidx-1], x-T[tidx-1]) max(x-S[sidx-1], x-T[tidx-1]) a2 S=[] [] S a3=S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1]) S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1]) a3 a2=float("INF") float("INF") a2 ans=min(a1,a2,a3,a4) min(a1,a2,a3,a4) ans sidx=bisect_left(S, x) bisect_left(S, x) sidx a3=float("INF") float("INF") a3
A,B,Q=map(int, input().split())
from bisect import bisect_left

S=[]
for i in range(A):
    s=int(input())
    S.append(s)
T=[]
for i in range(B):
    t=int(input())
    T.append(t)

for i in range(Q):
    x=int(input())
    sidx=bisect_left(S, x)
    tidx=bisect_left(T, x)
    if 0<=sidx<A and 0<=tidx<B:
        a1=max(S[sidx], T[tidx])-x
    else:
        a1=float("INF")
    if 0<=sidx-1<A and 0<=tidx-1<B:
        a2=max(x-S[sidx-1], x-T[tidx-1])
    else:
        a2=float("INF")
    if 0<=sidx<A and 0<=tidx-1<B:
        a3=S[sidx]-T[tidx-1]+min(S[sidx]-x, x-T[tidx-1])
    else:
        a3=float("INF")
    if 0<=sidx-1<A and 0<=tidx<B:
        a4=T[tidx]-S[sidx-1]+min(T[tidx]-x, x-S[sidx-1])
    else:
        a4=float("INF")
    #print(a1,a2,a3,a4)
    ans=min(a1,a2,a3,a4)
    print(ans)
