import sys
input=sys.stdin.readline

a,b,q=map(int,input().split())
A=[]
for i in range(a):
    A.append(int(input()))
B=[]
for i in range(b):
    B.append(int(input()))
Q={}
for i in range(q):
    Q[int(input())]=i
X=sorted(Q)

C=[]
now=0
for i in range(a):
    while now<b and A[i]>=B[now]:
        now+=1
    if now==0:
        C.append(abs(A[i]-B[0]))
    elif now==b:
        C.append(abs(A[i]-B[b-1]))
    else:
        C.append(min(abs(A[i]-B[now-1]),abs(A[i]-B[now])))
D=[]
now=0
for i in range(b):
    while now<a and B[i]>=A[now]:
        now+=1
    if now==0:
        D.append(abs(B[i]-A[0]))
    elif now==a:
        D.append(abs(B[i]-A[a-1]))
    else:
        D.append(min(abs(B[i]-A[now-1]),abs(B[i]-A[now])))

Y=[]
now=0
for i in range(q):
    while now<b and X[i]>=B[now]:
        now+=1
    if now==0:
        Y.append(abs(X[i]-B[0])+D[0])
    elif now==b:
        Y.append(abs(X[i]-B[b-1])+D[b-1])
    else:
        Y.append(min(abs(X[i]-B[now-1])+D[now-1],
                     abs(X[i]-B[now])+D[now]))
Z=[]
now=0
for i in range(q):
    while now<a and X[i]>=A[now]:
        now+=1
    if now==0:
        Z.append(abs(X[i]-A[0])+C[0])
    elif now==a:
        Z.append(abs(X[i]-A[a-1])+C[a-1])
    else:
        Z.append(min(abs(X[i]-A[now-1])+C[now-1],
                     abs(X[i]-A[now])+C[now]))
        
Ans=[0]*q
for i in range(q):
    x=Q[X[i]] #番号
    Ans[x]=min(Y[i],Z[i])
for ans in Ans:
    print(ans) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q A=[] A [] 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 B=[] B [] 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 Q={} Q {} for i in range(q):
    Q[int(input())]=i i range(q) range q Q[int(input())]=i Q[int(input())] Q int(input()) int input() input i X=sorted(Q) X sorted(Q) sorted Q C=[] C [] now=0 now 0 for i in range(a):
    while now<b and A[i]>=B[now]:
        now+=1
    if now==0:
        C.append(abs(A[i]-B[0]))
    elif now==b:
        C.append(abs(A[i]-B[b-1]))
    else:
        C.append(min(abs(A[i]-B[now-1]),abs(A[i]-B[now]))) i range(a) range a while now<b and A[i]>=B[now]:
        now+=1
     now<b and A[i]>=B[now] now<b now b A[i]>=B[now] A[i] A i B[now] B now now+=1 now 1 if now==0:
        C.append(abs(A[i]-B[0]))
    elif now==b:
        C.append(abs(A[i]-B[b-1]))
    else:
        C.append(min(abs(A[i]-B[now-1]),abs(A[i]-B[now]))) now==0 now 0 C.append(abs(A[i]-B[0])) C.append C append abs(A[i]-B[0]) abs A[i]-B[0] A[i] A i B[0] B 0 elif now==b:
        C.append(abs(A[i]-B[b-1]))
     now==b now b C.append(abs(A[i]-B[b-1])) C.append C append abs(A[i]-B[b-1]) abs A[i]-B[b-1] A[i] A i B[b-1] B b-1 b 1 C.append(min(abs(A[i]-B[now-1]),abs(A[i]-B[now]))) C.append C append min(abs(A[i]-B[now-1]),abs(A[i]-B[now])) min abs(A[i]-B[now-1]) abs A[i]-B[now-1] A[i] A i B[now-1] B now-1 now 1 abs(A[i]-B[now]) abs A[i]-B[now] A[i] A i B[now] B now D=[] D [] now=0 now 0 for i in range(b):
    while now<a and B[i]>=A[now]:
        now+=1
    if now==0:
        D.append(abs(B[i]-A[0]))
    elif now==a:
        D.append(abs(B[i]-A[a-1]))
    else:
        D.append(min(abs(B[i]-A[now-1]),abs(B[i]-A[now]))) i range(b) range b while now<a and B[i]>=A[now]:
        now+=1
     now<a and B[i]>=A[now] now<a now a B[i]>=A[now] B[i] B i A[now] A now now+=1 now 1 if now==0:
        D.append(abs(B[i]-A[0]))
    elif now==a:
        D.append(abs(B[i]-A[a-1]))
    else:
        D.append(min(abs(B[i]-A[now-1]),abs(B[i]-A[now]))) now==0 now 0 D.append(abs(B[i]-A[0])) D.append D append abs(B[i]-A[0]) abs B[i]-A[0] B[i] B i A[0] A 0 elif now==a:
        D.append(abs(B[i]-A[a-1]))
     now==a now a D.append(abs(B[i]-A[a-1])) D.append D append abs(B[i]-A[a-1]) abs B[i]-A[a-1] B[i] B i A[a-1] A a-1 a 1 D.append(min(abs(B[i]-A[now-1]),abs(B[i]-A[now]))) D.append D append min(abs(B[i]-A[now-1]),abs(B[i]-A[now])) min abs(B[i]-A[now-1]) abs B[i]-A[now-1] B[i] B i A[now-1] A now-1 now 1 abs(B[i]-A[now]) abs B[i]-A[now] B[i] B i A[now] A now Y=[] Y [] now=0 now 0 for i in range(q):
    while now<b and X[i]>=B[now]:
        now+=1
    if now==0:
        Y.append(abs(X[i]-B[0])+D[0])
    elif now==b:
        Y.append(abs(X[i]-B[b-1])+D[b-1])
    else:
        Y.append(min(abs(X[i]-B[now-1])+D[now-1],
                     abs(X[i]-B[now])+D[now])) i range(q) range q while now<b and X[i]>=B[now]:
        now+=1
     now<b and X[i]>=B[now] now<b now b X[i]>=B[now] X[i] X i B[now] B now now+=1 now 1 if now==0:
        Y.append(abs(X[i]-B[0])+D[0])
    elif now==b:
        Y.append(abs(X[i]-B[b-1])+D[b-1])
    else:
        Y.append(min(abs(X[i]-B[now-1])+D[now-1],
                     abs(X[i]-B[now])+D[now])) now==0 now 0 Y.append(abs(X[i]-B[0])+D[0]) Y.append Y append abs(X[i]-B[0])+D[0] abs(X[i]-B[0]) abs X[i]-B[0] X[i] X i B[0] B 0 D[0] D 0 elif now==b:
        Y.append(abs(X[i]-B[b-1])+D[b-1])
     now==b now b Y.append(abs(X[i]-B[b-1])+D[b-1]) Y.append Y append abs(X[i]-B[b-1])+D[b-1] abs(X[i]-B[b-1]) abs X[i]-B[b-1] X[i] X i B[b-1] B b-1 b 1 D[b-1] D b-1 b 1 Y.append(min(abs(X[i]-B[now-1])+D[now-1],
                     abs(X[i]-B[now])+D[now])) Y.append Y append min(abs(X[i]-B[now-1])+D[now-1],
                     abs(X[i]-B[now])+D[now]) min abs(X[i]-B[now-1])+D[now-1] abs(X[i]-B[now-1]) abs X[i]-B[now-1] X[i] X i B[now-1] B now-1 now 1 D[now-1] D now-1 now 1 abs(X[i]-B[now])+D[now] abs(X[i]-B[now]) abs X[i]-B[now] X[i] X i B[now] B now D[now] D now Z=[] Z [] now=0 now 0 for i in range(q):
    while now<a and X[i]>=A[now]:
        now+=1
    if now==0:
        Z.append(abs(X[i]-A[0])+C[0])
    elif now==a:
        Z.append(abs(X[i]-A[a-1])+C[a-1])
    else:
        Z.append(min(abs(X[i]-A[now-1])+C[now-1],
                     abs(X[i]-A[now])+C[now]))
         i range(q) range q while now<a and X[i]>=A[now]:
        now+=1
     now<a and X[i]>=A[now] now<a now a X[i]>=A[now] X[i] X i A[now] A now now+=1 now 1 if now==0:
        Z.append(abs(X[i]-A[0])+C[0])
    elif now==a:
        Z.append(abs(X[i]-A[a-1])+C[a-1])
    else:
        Z.append(min(abs(X[i]-A[now-1])+C[now-1],
                     abs(X[i]-A[now])+C[now]))
         now==0 now 0 Z.append(abs(X[i]-A[0])+C[0]) Z.append Z append abs(X[i]-A[0])+C[0] abs(X[i]-A[0]) abs X[i]-A[0] X[i] X i A[0] A 0 C[0] C 0 elif now==a:
        Z.append(abs(X[i]-A[a-1])+C[a-1])
     now==a now a Z.append(abs(X[i]-A[a-1])+C[a-1]) Z.append Z append abs(X[i]-A[a-1])+C[a-1] abs(X[i]-A[a-1]) abs X[i]-A[a-1] X[i] X i A[a-1] A a-1 a 1 C[a-1] C a-1 a 1 Z.append(min(abs(X[i]-A[now-1])+C[now-1],
                     abs(X[i]-A[now])+C[now])) Z.append Z append min(abs(X[i]-A[now-1])+C[now-1],
                     abs(X[i]-A[now])+C[now]) min abs(X[i]-A[now-1])+C[now-1] abs(X[i]-A[now-1]) abs X[i]-A[now-1] X[i] X i A[now-1] A now-1 now 1 C[now-1] C now-1 now 1 abs(X[i]-A[now])+C[now] abs(X[i]-A[now]) abs X[i]-A[now] X[i] X i A[now] A now C[now] C now Ans=[0]*q Ans [0]*q [0] 0 q for i in range(q):
    x=Q[X[i]] #番号
    Ans[x]=min(Y[i],Z[i]) i range(q) range q x=Q[X[i]] x Q[X[i]] Q X[i] X i Ans[x]=min(Y[i],Z[i]) Ans[x] Ans x min(Y[i],Z[i]) min Y[i] Y i Z[i] Z i for ans in Ans:
    print(ans) ans Ans print(ans) print ans D=[] [] D C=[] [] C now+=1 1 now x=Q[X[i]] Q[X[i]] x Z=[] [] Z b,q=map(int,input().split()) map(int,input().split()) b now=0 0 now now+=1 1 now A=[] [] A Q={} {} Q a,b,q=map(int,input().split()) map(int,input().split()) a q=map(int,input().split()) map(int,input().split()) q now+=1 1 now Ans=[0]*q [0]*q Ans input=sys.stdin.readline sys.stdin.readline input now=0 0 now now=0 0 now B=[] [] B now+=1 1 now now=0 0 now X=sorted(Q) sorted(Q) X Y=[] [] Y
import sys
input=sys.stdin.readline

a,b,q=map(int,input().split())
A=[]
for i in range(a):
    A.append(int(input()))
B=[]
for i in range(b):
    B.append(int(input()))
Q={}
for i in range(q):
    Q[int(input())]=i
X=sorted(Q)

C=[]
now=0
for i in range(a):
    while now<b and A[i]>=B[now]:
        now+=1
    if now==0:
        C.append(abs(A[i]-B[0]))
    elif now==b:
        C.append(abs(A[i]-B[b-1]))
    else:
        C.append(min(abs(A[i]-B[now-1]),abs(A[i]-B[now])))
D=[]
now=0
for i in range(b):
    while now<a and B[i]>=A[now]:
        now+=1
    if now==0:
        D.append(abs(B[i]-A[0]))
    elif now==a:
        D.append(abs(B[i]-A[a-1]))
    else:
        D.append(min(abs(B[i]-A[now-1]),abs(B[i]-A[now])))

Y=[]
now=0
for i in range(q):
    while now<b and X[i]>=B[now]:
        now+=1
    if now==0:
        Y.append(abs(X[i]-B[0])+D[0])
    elif now==b:
        Y.append(abs(X[i]-B[b-1])+D[b-1])
    else:
        Y.append(min(abs(X[i]-B[now-1])+D[now-1],
                     abs(X[i]-B[now])+D[now]))
Z=[]
now=0
for i in range(q):
    while now<a and X[i]>=A[now]:
        now+=1
    if now==0:
        Z.append(abs(X[i]-A[0])+C[0])
    elif now==a:
        Z.append(abs(X[i]-A[a-1])+C[a-1])
    else:
        Z.append(min(abs(X[i]-A[now-1])+C[now-1],
                     abs(X[i]-A[now])+C[now]))
        
Ans=[0]*q
for i in range(q):
    x=Q[X[i]] #番号
    Ans[x]=min(Y[i],Z[i])
for ans in Ans:
    print(ans)