from bisect import bisect_left

A, B, Q = map(int, input().split())
INF = 10**12
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]

for _ in range(Q):
    x = int(input())
    si = bisect_left(s,x)
    ti = bisect_left(t,x)
    sl = [s[si-1],s[si]]
    tl = [t[ti-1],t[ti]]
    ans = INF
    for i in range(2):
        for j in range(2):
            ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i]))
    print(ans) from bisect import bisect_left A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q INF = 10**12 INF 10**12 10 12 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input s = [-INF] + [int(input()) for _ in range(A)] + [INF] s [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] [-INF] -INF INF [int(input()) for _ in range(A)] [INF] INF int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t = [-INF] + [int(input()) for _ in range(B)] + [INF] t [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] [-INF] -INF INF [int(input()) for _ in range(B)] [INF] INF for _ in range(Q):
    x = int(input())
    si = bisect_left(s,x)
    ti = bisect_left(t,x)
    sl = [s[si-1],s[si]]
    tl = [t[ti-1],t[ti]]
    ans = INF
    for i in range(2):
        for j in range(2):
            ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i]))
    print(ans) _ range(Q) range Q x = int(input()) x int(input()) int input() input si = bisect_left(s,x) si bisect_left(s,x) bisect_left s x ti = bisect_left(t,x) ti bisect_left(t,x) bisect_left t x sl = [s[si-1],s[si]] sl [s[si-1],s[si]] s[si-1] s si-1 si 1 s[si] s si tl = [t[ti-1],t[ti]] tl [t[ti-1],t[ti]] t[ti-1] t ti-1 ti 1 t[ti] t ti ans = INF ans INF for i in range(2):
        for j in range(2):
            ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i]))
     i range(2) range 2 for j in range(2):
            ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i]))
     j range(2) range 2 ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i])) ans min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i])) min ans abs(x-sl[i])+abs(sl[i]-tl[j]) abs(x-sl[i]) abs x-sl[i] x sl[i] sl i abs(sl[i]-tl[j]) abs sl[i]-tl[j] sl[i] sl i tl[j] tl j abs(x-tl[j])+abs(tl[j]-sl[i]) abs(x-tl[j]) abs x-tl[j] x tl[j] tl j abs(tl[j]-sl[i]) abs tl[j]-sl[i] tl[j] tl j sl[i] sl i print(ans) print ans s = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] s ans = INF INF ans B, Q = map(int, input().split()) map(int, input().split()) B ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i])) min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i])) ans ti = bisect_left(t,x) bisect_left(t,x) ti tl = [t[ti-1],t[ti]] [t[ti-1],t[ti]] tl sl = [s[si-1],s[si]] [s[si-1],s[si]] sl x = int(input()) int(input()) x si = bisect_left(s,x) bisect_left(s,x) si Q = map(int, input().split()) map(int, input().split()) Q t = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] t INF = 10**12 10**12 INF A, B, Q = map(int, input().split()) map(int, input().split()) A
from bisect import bisect_left

A, B, Q = map(int, input().split())
INF = 10**12
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]

for _ in range(Q):
    x = int(input())
    si = bisect_left(s,x)
    ti = bisect_left(t,x)
    sl = [s[si-1],s[si]]
    tl = [t[ti-1],t[ti]]
    ans = INF
    for i in range(2):
        for j in range(2):
            ans = min(ans, abs(x-sl[i])+abs(sl[i]-tl[j]), abs(x-tl[j])+abs(tl[j]-sl[i]))
    print(ans)