import bisect
a,b,q=map(int,input().split())
shrines=[-10**20]+[int(input()) for i in range(a)]+[10**20]
temples=[-10**20]+[int(input()) for i in range(b)]+[10**20]
for i in range(q):
    x=int(input())
    s=bisect.bisect_left(shrines,x)
    t=bisect.bisect_left(temples,x)
    Dsleft=x-shrines[s-1]
    Dtleft=x-temples[t-1]
    Dsright=shrines[s]-x
    Dtright=temples[t]-x
    print(min(max(Dsleft,Dtleft),max(Dsright,Dtright),Dsleft+Dtright+min(Dsleft,Dtright),Dsright+Dtleft+min(Dsright,Dtleft))) import bisect 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 shrines=[-10**20]+[int(input()) for i in range(a)]+[10**20] shrines [-10**20]+[int(input()) for i in range(a)]+[10**20] [-10**20]+[int(input()) for i in range(a)] [-10**20] -10**20 -10 20 [int(input()) for i in range(a)] [10**20] 10**20 10 20 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 temples=[-10**20]+[int(input()) for i in range(b)]+[10**20] temples [-10**20]+[int(input()) for i in range(b)]+[10**20] [-10**20]+[int(input()) for i in range(b)] [-10**20] -10**20 -10 20 [int(input()) for i in range(b)] [10**20] 10**20 10 20 for i in range(q):
    x=int(input())
    s=bisect.bisect_left(shrines,x)
    t=bisect.bisect_left(temples,x)
    Dsleft=x-shrines[s-1]
    Dtleft=x-temples[t-1]
    Dsright=shrines[s]-x
    Dtright=temples[t]-x
    print(min(max(Dsleft,Dtleft),max(Dsright,Dtright),Dsleft+Dtright+min(Dsleft,Dtright),Dsright+Dtleft+min(Dsright,Dtleft))) i range(q) range q x=int(input()) x int(input()) int input() input s=bisect.bisect_left(shrines,x) s bisect.bisect_left(shrines,x) bisect.bisect_left bisect bisect_left shrines x t=bisect.bisect_left(temples,x) t bisect.bisect_left(temples,x) bisect.bisect_left bisect bisect_left temples x Dsleft=x-shrines[s-1] Dsleft x-shrines[s-1] x shrines[s-1] shrines s-1 s 1 Dtleft=x-temples[t-1] Dtleft x-temples[t-1] x temples[t-1] temples t-1 t 1 Dsright=shrines[s]-x Dsright shrines[s]-x shrines[s] shrines s x Dtright=temples[t]-x Dtright temples[t]-x temples[t] temples t x print(min(max(Dsleft,Dtleft),max(Dsright,Dtright),Dsleft+Dtright+min(Dsleft,Dtright),Dsright+Dtleft+min(Dsright,Dtleft))) print min(max(Dsleft,Dtleft),max(Dsright,Dtright),Dsleft+Dtright+min(Dsleft,Dtright),Dsright+Dtleft+min(Dsright,Dtleft)) min max(Dsleft,Dtleft) max Dsleft Dtleft max(Dsright,Dtright) max Dsright Dtright Dsleft+Dtright+min(Dsleft,Dtright) Dsleft+Dtright Dsleft Dtright min(Dsleft,Dtright) min Dsleft Dtright Dsright+Dtleft+min(Dsright,Dtleft) Dsright+Dtleft Dsright Dtleft min(Dsright,Dtleft) min Dsright Dtleft q=map(int,input().split()) map(int,input().split()) q x=int(input()) int(input()) x s=bisect.bisect_left(shrines,x) bisect.bisect_left(shrines,x) s Dsright=shrines[s]-x shrines[s]-x Dsright temples=[-10**20]+[int(input()) for i in range(b)]+[10**20] [-10**20]+[int(input()) for i in range(b)]+[10**20] temples Dsleft=x-shrines[s-1] x-shrines[s-1] Dsleft Dtright=temples[t]-x temples[t]-x Dtright b,q=map(int,input().split()) map(int,input().split()) b a,b,q=map(int,input().split()) map(int,input().split()) a shrines=[-10**20]+[int(input()) for i in range(a)]+[10**20] [-10**20]+[int(input()) for i in range(a)]+[10**20] shrines t=bisect.bisect_left(temples,x) bisect.bisect_left(temples,x) t Dtleft=x-temples[t-1] x-temples[t-1] Dtleft
import bisect
a,b,q=map(int,input().split())
shrines=[-10**20]+[int(input()) for i in range(a)]+[10**20]
temples=[-10**20]+[int(input()) for i in range(b)]+[10**20]
for i in range(q):
    x=int(input())
    s=bisect.bisect_left(shrines,x)
    t=bisect.bisect_left(temples,x)
    Dsleft=x-shrines[s-1]
    Dtleft=x-temples[t-1]
    Dsright=shrines[s]-x
    Dtright=temples[t]-x
    print(min(max(Dsleft,Dtleft),max(Dsright,Dtright),Dsleft+Dtright+min(Dsleft,Dtright),Dsright+Dtleft+min(Dsright,Dtleft)))