import math
import bisect
inf=10**12
a,b,q=map(int,input().split())
s=[-inf]+[int(input()) for _ in range(a)]+[inf];s.sort()
t=[-inf]+[int(input()) for _ in range(b)]+[inf];t.sort()

for i in range(q):
    x=int(input())
    p=bisect.bisect_left(s,x)
    q=bisect.bisect_left(t,x)

    sl,sr,tl,tr=s[p-1],s[p],t[q-1],t[q]

    sltl=x-min(sl,tl)
    srtr=max(sr,tr)-x
    sltr=min(x-sl*2+tr,-x-sl+tr*2)
    srtl=min(x-tl*2+sr,-x-tl+sr*2)
    print(min(sltl,srtr,sltr,srtl)) import math math import bisect bisect inf=10**12 inf 10**12 10 12 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=[-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 s.sort() s.sort s sort 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 t.sort() t.sort t sort for i in range(q):
    x=int(input())
    p=bisect.bisect_left(s,x)
    q=bisect.bisect_left(t,x)

    sl,sr,tl,tr=s[p-1],s[p],t[q-1],t[q]

    sltl=x-min(sl,tl)
    srtr=max(sr,tr)-x
    sltr=min(x-sl*2+tr,-x-sl+tr*2)
    srtl=min(x-tl*2+sr,-x-tl+sr*2)
    print(min(sltl,srtr,sltr,srtl)) i range(q) range q x=int(input()) x int(input()) int input() input p=bisect.bisect_left(s,x) p bisect.bisect_left(s,x) bisect.bisect_left bisect bisect_left s x q=bisect.bisect_left(t,x) q bisect.bisect_left(t,x) bisect.bisect_left bisect bisect_left t x sl,sr,tl,tr=s[p-1],s[p],t[q-1],t[q] sl s[p-1] s p-1 p 1 sr s[p] s p tl t[q-1] t q-1 q 1 tr t[q] t q sltl=x-min(sl,tl) sltl x-min(sl,tl) x min(sl,tl) min sl tl srtr=max(sr,tr)-x srtr max(sr,tr)-x max(sr,tr) max sr tr x sltr=min(x-sl*2+tr,-x-sl+tr*2) sltr min(x-sl*2+tr,-x-sl+tr*2) min x-sl*2+tr x-sl*2 x sl*2 sl 2 tr -x-sl+tr*2 -x-sl -x x sl tr*2 tr 2 srtl=min(x-tl*2+sr,-x-tl+sr*2) srtl min(x-tl*2+sr,-x-tl+sr*2) min x-tl*2+sr x-tl*2 x tl*2 tl 2 sr -x-tl+sr*2 -x-tl -x x tl sr*2 sr 2 print(min(sltl,srtr,sltr,srtl)) print min(sltl,srtr,sltr,srtl) min sltl srtr sltr srtl a,b,q=map(int,input().split()) map(int,input().split()) a srtl=min(x-tl*2+sr,-x-tl+sr*2) min(x-tl*2+sr,-x-tl+sr*2) srtl p=bisect.bisect_left(s,x) bisect.bisect_left(s,x) p tl,tr=s[p-1],s[p],t[q-1],t[q] t[q-1] tl srtr=max(sr,tr)-x max(sr,tr)-x srtr x=int(input()) int(input()) x sltl=x-min(sl,tl) x-min(sl,tl) sltl sltr=min(x-sl*2+tr,-x-sl+tr*2) min(x-sl*2+tr,-x-sl+tr*2) sltr b,q=map(int,input().split()) map(int,input().split()) b sl,sr,tl,tr=s[p-1],s[p],t[q-1],t[q] s[p-1] sl tr=s[p-1],s[p],t[q-1],t[q] t[q] tr sr,tl,tr=s[p-1],s[p],t[q-1],t[q] s[p] sr inf=10**12 10**12 inf s=[-inf]+[int(input()) for _ in range(a)]+[inf] [-inf]+[int(input()) for _ in range(a)]+[inf] s q=bisect.bisect_left(t,x) bisect.bisect_left(t,x) q q=map(int,input().split()) map(int,input().split()) q t=[-inf]+[int(input()) for _ in range(b)]+[inf] [-inf]+[int(input()) for _ in range(b)]+[inf] t
import math
import bisect
inf=10**12
a,b,q=map(int,input().split())
s=[-inf]+[int(input()) for _ in range(a)]+[inf];s.sort()
t=[-inf]+[int(input()) for _ in range(b)]+[inf];t.sort()

for i in range(q):
    x=int(input())
    p=bisect.bisect_left(s,x)
    q=bisect.bisect_left(t,x)

    sl,sr,tl,tr=s[p-1],s[p],t[q-1],t[q]

    sltl=x-min(sl,tl)
    srtr=max(sr,tr)-x
    sltr=min(x-sl*2+tr,-x-sl+tr*2)
    srtl=min(x-tl*2+sr,-x-tl+sr*2)
    print(min(sltl,srtr,sltr,srtl))