import bisect
a,b,q=map(int,input().split())
A=[-1*(10**12)]
B=[-1*(10**12)]
for i in range(a):
    A.append(int(input()))
for i in range(b):
    B.append(int(input()))

A.append(10**12)
B.append(10**12)

for i in range(q):
    x=int(input())
    ia=bisect.bisect_right(A,x)

    ms=A[ia-1]
    ps=A[ia]
    
    ib=bisect.bisect_right(B,x)
    
    mt=B[ib-1]
    pt=B[ib]
        
    ans=min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms))
    print(ans) import bisect bisect a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q A=[-1*(10**12)] A [-1*(10**12)] -1*(10**12) -1 10**12 10 12 B=[-1*(10**12)] B [-1*(10**12)] -1*(10**12) -1 10**12 10 12 for i in range(a):
    A.append(int(input())) i range(a) range a A.append(int(input())) A.append A append int(input()) int input() input for i in range(b):
    B.append(int(input())) i range(b) range b B.append(int(input())) B.append B append int(input()) int input() input A.append(10**12) A.append A append 10**12 10 12 B.append(10**12) B.append B append 10**12 10 12 for i in range(q):
    x=int(input())
    ia=bisect.bisect_right(A,x)

    ms=A[ia-1]
    ps=A[ia]
    
    ib=bisect.bisect_right(B,x)
    
    mt=B[ib-1]
    pt=B[ib]
        
    ans=min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms))
    print(ans) i range(q) range q x=int(input()) x int(input()) int input() input ia=bisect.bisect_right(A,x) ia bisect.bisect_right(A,x) bisect.bisect_right bisect bisect_right A x ms=A[ia-1] ms A[ia-1] A ia-1 ia 1 ps=A[ia] ps A[ia] A ia ib=bisect.bisect_right(B,x) ib bisect.bisect_right(B,x) bisect.bisect_right bisect bisect_right B x mt=B[ib-1] mt B[ib-1] B ib-1 ib 1 pt=B[ib] pt B[ib] B ib ans=min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms)) ans min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms)) min x-min(ms,mt) x min(ms,mt) min ms mt max(ps,pt)-x max(ps,pt) max ps pt x (ps-mt)+min(ps-x,x-mt) ps-mt ps mt min(ps-x,x-mt) min ps-x ps x x-mt x mt (pt-ms)+min(pt-x,x-ms) pt-ms pt ms min(pt-x,x-ms) min pt-x pt x x-ms x ms print(ans) print ans mt=B[ib-1] B[ib-1] mt b,q=map(int,input().split()) map(int,input().split()) b pt=B[ib] B[ib] pt x=int(input()) int(input()) x ib=bisect.bisect_right(B,x) bisect.bisect_right(B,x) ib ms=A[ia-1] A[ia-1] ms A=[-1*(10**12)] [-1*(10**12)] A B=[-1*(10**12)] [-1*(10**12)] B ps=A[ia] A[ia] ps a,b,q=map(int,input().split()) map(int,input().split()) a ans=min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms)) min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms)) ans ia=bisect.bisect_right(A,x) bisect.bisect_right(A,x) ia q=map(int,input().split()) map(int,input().split()) q
import bisect
a,b,q=map(int,input().split())
A=[-1*(10**12)]
B=[-1*(10**12)]
for i in range(a):
    A.append(int(input()))
for i in range(b):
    B.append(int(input()))

A.append(10**12)
B.append(10**12)

for i in range(q):
    x=int(input())
    ia=bisect.bisect_right(A,x)

    ms=A[ia-1]
    ps=A[ia]
    
    ib=bisect.bisect_right(B,x)
    
    mt=B[ib-1]
    pt=B[ib]
        
    ans=min(x-min(ms,mt),max(ps,pt)-x,(ps-mt)+min(ps-x,x-mt),(pt-ms)+min(pt-x,x-ms))
    print(ans)