def near(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x
    elif i == len(Y):
        return x-Y[i-1]
    else:
        return min(Y[i]-x, x-Y[i-1])

def near2(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x + D[i][1]
    elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
    else:
        return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1])

from bisect import *
A, B, Q = map(int, input().split())
S = []
T = []
for _ in range(A):
    S.append(int(input()))
for _ in range(B):
    T.append(int(input()))
D = []
for a in S:
    D.append((a, near(a, T)))
for b in T:
    D.append((b, near(b, S)))
D.sort(key=lambda x:x[0])
D2 = [d for d, _ in D]
for _ in range(Q):
    x = int(input())
    print(near2(x,D2))
 def near(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x
    elif i == len(Y):
        return x-Y[i-1]
    else:
        return min(Y[i]-x, x-Y[i-1]) near i = bisect_left(Y,x) i bisect_left(Y,x) bisect_left Y x if i == 0:
        return Y[i]-x
    elif i == len(Y):
        return x-Y[i-1]
    else:
        return min(Y[i]-x, x-Y[i-1]) i == 0 i 0 return Y[i]-x Y[i]-x Y[i] Y i x elif i == len(Y):
        return x-Y[i-1]
     i == len(Y) i len(Y) len Y return x-Y[i-1] x-Y[i-1] x Y[i-1] Y i-1 i 1 return min(Y[i]-x, x-Y[i-1]) min(Y[i]-x, x-Y[i-1]) min Y[i]-x Y[i] Y i x x-Y[i-1] x Y[i-1] Y i-1 i 1 x x Y Y def near2(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x + D[i][1]
    elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
    else:
        return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1]) near2 i = bisect_left(Y,x) i bisect_left(Y,x) bisect_left Y x if i == 0:
        return Y[i]-x + D[i][1]
    elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
    else:
        return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1]) i == 0 i 0 return Y[i]-x + D[i][1] Y[i]-x + D[i][1] Y[i]-x Y[i] Y i x D[i][1] [i] D i 1 elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
     i == len(Y) i len(Y) len Y return x-Y[i-1] + D[i-1][1] x-Y[i-1] + D[i-1][1] x-Y[i-1] x Y[i-1] Y i-1 i 1 D[i-1][1] [i-1] D i-1 i 1 1 return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1]) min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1]) min Y[i]-x+D[i][1] Y[i]-x Y[i] Y i x D[i][1] [i] D i 1 x-Y[i-1]+D[i-1][1] x-Y[i-1] x Y[i-1] Y i-1 i 1 D[i-1][1] [i-1] D i-1 i 1 1 x x Y Y from bisect import * A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q S = [] S [] T = [] T [] for _ in range(A):
    S.append(int(input())) _ range(A) range A S.append(int(input())) S.append S append int(input()) int input() input for _ in range(B):
    T.append(int(input())) _ range(B) range B T.append(int(input())) T.append T append int(input()) int input() input D = [] D [] for a in S:
    D.append((a, near(a, T))) a S D.append((a, near(a, T))) D.append D append (a, near(a, T)) a near(a, T) near a T for b in T:
    D.append((b, near(b, S))) b T D.append((b, near(b, S))) D.append D append (b, near(b, S)) b near(b, S) near b S D.sort(key=lambda x:x[0]) D.sort D sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x d for d, _ in D for d, _ in D d _ D for d, _ in D d D2 = [d for d, _ in D] D2 [d for d, _ in D] for _ in range(Q):
    x = int(input())
    print(near2(x,D2)) _ range(Q) range Q x = int(input()) x int(input()) int input() input print(near2(x,D2)) print near2(x,D2) near2 x D2 T = [] [] T B, Q = map(int, input().split()) map(int, input().split()) B D = [] [] D S = [] [] S x = int(input()) int(input()) x def near2(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x + D[i][1]
    elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
    else:
        return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1]) def near2(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x + D[i][1]
    elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
    else:
        return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1]) near2 D2 = [d for d, _ in D] [d for d, _ in D] D2 def near(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x
    elif i == len(Y):
        return x-Y[i-1]
    else:
        return min(Y[i]-x, x-Y[i-1]) def near(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x
    elif i == len(Y):
        return x-Y[i-1]
    else:
        return min(Y[i]-x, x-Y[i-1]) near Q = map(int, input().split()) map(int, input().split()) Q A, B, Q = map(int, input().split()) map(int, input().split()) A
def near(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x
    elif i == len(Y):
        return x-Y[i-1]
    else:
        return min(Y[i]-x, x-Y[i-1])

def near2(x, Y):
    i = bisect_left(Y,x)
    if i == 0:
        return Y[i]-x + D[i][1]
    elif i == len(Y):
        return x-Y[i-1] + D[i-1][1]
    else:
        return min(Y[i]-x+D[i][1], x-Y[i-1]+D[i-1][1])

from bisect import *
A, B, Q = map(int, input().split())
S = []
T = []
for _ in range(A):
    S.append(int(input()))
for _ in range(B):
    T.append(int(input()))
D = []
for a in S:
    D.append((a, near(a, T)))
for b in T:
    D.append((b, near(b, S)))
D.sort(key=lambda x:x[0])
D2 = [d for d, _ in D]
for _ in range(Q):
    x = int(input())
    print(near2(x,D2))

