a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]

S.sort()
T.sort()

S = [-10**18]+S+[10**18]
T = [-10**18]+T+[10**18]

import bisect

for i in range(q):
    x = int(input())
    j = bisect.bisect_left(S, x)
    k = bisect.bisect_left(T, x)
    ans = 10**18
    for dj, dk in (-1, -1), (-1, 0), (0, -1), (0, 0):
        nj = j+dj
        nk = k+dk
        temp = min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj]))
        ans = min(ans, temp)
    print(ans) 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)] S.sort() S.sort S sort T.sort() T.sort T sort S = [-10**18]+S+[10**18] S [-10**18]+S+[10**18] [-10**18]+S [-10**18] -10**18 -10 18 S [10**18] 10**18 10 18 T = [-10**18]+T+[10**18] T [-10**18]+T+[10**18] [-10**18]+T [-10**18] -10**18 -10 18 T [10**18] 10**18 10 18 import bisect bisect for i in range(q):
    x = int(input())
    j = bisect.bisect_left(S, x)
    k = bisect.bisect_left(T, x)
    ans = 10**18
    for dj, dk in (-1, -1), (-1, 0), (0, -1), (0, 0):
        nj = j+dj
        nk = k+dk
        temp = min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj]))
        ans = min(ans, temp)
    print(ans) i range(q) range q x = int(input()) x int(input()) int input() input j = bisect.bisect_left(S, x) j bisect.bisect_left(S, x) bisect.bisect_left bisect bisect_left S x k = bisect.bisect_left(T, x) k bisect.bisect_left(T, x) bisect.bisect_left bisect bisect_left T x ans = 10**18 ans 10**18 10 18 for dj, dk in (-1, -1), (-1, 0), (0, -1), (0, 0):
        nj = j+dj
        nk = k+dk
        temp = min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj]))
        ans = min(ans, temp)
     dj dk (-1, -1) -1 -1 nj = j+dj nj j+dj j dj nk = k+dk nk k+dk k dk temp = min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj])) temp min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj])) min abs(S[nj]-x)+abs(T[nk]-S[nj]) abs(S[nj]-x) abs S[nj]-x S[nj] S nj x abs(T[nk]-S[nj]) abs T[nk]-S[nj] T[nk] T nk S[nj] S nj abs(T[nk]-x)+abs(T[nk]-S[nj]) abs(T[nk]-x) abs T[nk]-x T[nk] T nk x abs(T[nk]-S[nj]) abs T[nk]-S[nj] T[nk] T nk S[nj] S nj ans = min(ans, temp) ans min(ans, temp) min ans temp print(ans) print ans a, b, q = map(int, input().split()) map(int, input().split()) a j = bisect.bisect_left(S, x) bisect.bisect_left(S, x) j ans = min(ans, temp) min(ans, temp) ans q = map(int, input().split()) map(int, input().split()) q k = bisect.bisect_left(T, x) bisect.bisect_left(T, x) k T = [-10**18]+T+[10**18] [-10**18]+T+[10**18] T nj = j+dj j+dj nj 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 x = int(input()) int(input()) x ans = 10**18 10**18 ans nk = k+dk k+dk nk S = [-10**18]+S+[10**18] [-10**18]+S+[10**18] S T = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] T temp = min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj])) min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj])) temp
a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]

S.sort()
T.sort()

S = [-10**18]+S+[10**18]
T = [-10**18]+T+[10**18]

import bisect

for i in range(q):
    x = int(input())
    j = bisect.bisect_left(S, x)
    k = bisect.bisect_left(T, x)
    ans = 10**18
    for dj, dk in (-1, -1), (-1, 0), (0, -1), (0, 0):
        nj = j+dj
        nk = k+dk
        temp = min(abs(S[nj]-x)+abs(T[nk]-S[nj]), abs(T[nk]-x)+abs(T[nk]-S[nj]))
        ans = min(ans, temp)
    print(ans)
