import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

def D(a,b,c):
    return abs(a-b) + abs(b-c)

def getAns(x):
    ret = 10**18
    U = [S, T]
    for k in range(len(U)):
        u = U[k]
        v = U[(k-1)%2]
        idx = bisect.bisect_left(u, x)
        for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
    return ret

for x in X:
    print(getAns(x))


 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 _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input S = [int(input()) for _ in range(A)] S [int(input()) for _ in range(A)] int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input T = [int(input()) for _ in range(B)] T [int(input()) for _ in range(B)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input X = [int(input()) for _ in range(Q)] X [int(input()) for _ in range(Q)] def D(a,b,c):
    return abs(a-b) + abs(b-c) D return abs(a-b) + abs(b-c) abs(a-b) + abs(b-c) abs(a-b) abs a-b a b abs(b-c) abs b-c b c a a b b c c def getAns(x):
    ret = 10**18
    U = [S, T]
    for k in range(len(U)):
        u = U[k]
        v = U[(k-1)%2]
        idx = bisect.bisect_left(u, x)
        for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
    return ret getAns ret = 10**18 ret 10**18 10 18 U = [S, T] U [S, T] S T for k in range(len(U)):
        u = U[k]
        v = U[(k-1)%2]
        idx = bisect.bisect_left(u, x)
        for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
     k range(len(U)) range len(U) len U u = U[k] u U[k] U k v = U[(k-1)%2] v U[(k-1)%2] U (k-1)%2 k-1 k 1 2 idx = bisect.bisect_left(u, x) idx bisect.bisect_left(u, x) bisect.bisect_left bisect bisect_left u x for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
     i [idx-1, idx] idx-1 idx 1 idx if not 0<=i<len(u):
                continue
             not 0<=i<len(u) 0<=i<len(u) 0<=i 0 i len(u) len u continue idxx = bisect.bisect_left(v, u[i]) idxx bisect.bisect_left(v, u[i]) bisect.bisect_left bisect bisect_left v u[i] u i for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
     j [idxx-1, idxx] idxx-1 idxx 1 idxx if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
     0<=j<len(v) 0<=j 0 j len(v) len v ret = min(ret, D(x, u[i], v[j])) ret min(ret, D(x, u[i], v[j])) min ret D(x, u[i], v[j]) D x u[i] u i v[j] v j return ret ret x x for x in X:
    print(getAns(x)) x X print(getAns(x)) print getAns(x) getAns x T = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] T def getAns(x):
    ret = 10**18
    U = [S, T]
    for k in range(len(U)):
        u = U[k]
        v = U[(k-1)%2]
        idx = bisect.bisect_left(u, x)
        for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
    return ret def getAns(x):
    ret = 10**18
    U = [S, T]
    for k in range(len(U)):
        u = U[k]
        v = U[(k-1)%2]
        idx = bisect.bisect_left(u, x)
        for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
    return ret getAns B, Q = map(int, input().split()) map(int, input().split()) B S = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] S A, B, Q = map(int, input().split()) map(int, input().split()) A Q = map(int, input().split()) map(int, input().split()) Q X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X def D(a,b,c):
    return abs(a-b) + abs(b-c) def D(a,b,c):
    return abs(a-b) + abs(b-c) D
import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

def D(a,b,c):
    return abs(a-b) + abs(b-c)

def getAns(x):
    ret = 10**18
    U = [S, T]
    for k in range(len(U)):
        u = U[k]
        v = U[(k-1)%2]
        idx = bisect.bisect_left(u, x)
        for i in [idx-1, idx]:
            if not 0<=i<len(u):
                continue
            idxx = bisect.bisect_left(v, u[i])
            for j in [idxx-1, idxx]:
                if 0<=j<len(v):
                    ret = min(ret, D(x, u[i], v[j]))
    return ret

for x in X:
    print(getAns(x))



