a, b, q = map(int, input().split())
INF = 10 ** 15
s = [-INF] + [int(input()) for _ in range(a)] + [INF] # sorted
t = [-INF] + [int(input()) for _ in range(b)] + [INF] # sorted

from bisect import bisect_left, bisect_right

for _ in range(q):
    x = int(input())
    i = bisect_left(s, x)
    j = bisect_left(t, x)
    d = INF
    for sx in [s[i - 1], s[i]]:
        for tx in [t[j - 1], t[j]]:
            d1 = abs(sx - x) + abs(sx - tx)
            d2 = abs(tx - x) + abs(sx - tx)
            d = min(d, d1, d2)
    print(d) a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q INF = 10 ** 15 INF 10 ** 15 10 15 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 from bisect import bisect_left, bisect_right for _ in range(q):
    x = int(input())
    i = bisect_left(s, x)
    j = bisect_left(t, x)
    d = INF
    for sx in [s[i - 1], s[i]]:
        for tx in [t[j - 1], t[j]]:
            d1 = abs(sx - x) + abs(sx - tx)
            d2 = abs(tx - x) + abs(sx - tx)
            d = min(d, d1, d2)
    print(d) _ range(q) range q x = int(input()) x int(input()) int input() input i = bisect_left(s, x) i bisect_left(s, x) bisect_left s x j = bisect_left(t, x) j bisect_left(t, x) bisect_left t x d = INF d INF for sx in [s[i - 1], s[i]]:
        for tx in [t[j - 1], t[j]]:
            d1 = abs(sx - x) + abs(sx - tx)
            d2 = abs(tx - x) + abs(sx - tx)
            d = min(d, d1, d2)
     sx [s[i - 1], s[i]] s[i - 1] s i - 1 i 1 s[i] s i for tx in [t[j - 1], t[j]]:
            d1 = abs(sx - x) + abs(sx - tx)
            d2 = abs(tx - x) + abs(sx - tx)
            d = min(d, d1, d2)
     tx [t[j - 1], t[j]] t[j - 1] t j - 1 j 1 t[j] t j d1 = abs(sx - x) + abs(sx - tx) d1 abs(sx - x) + abs(sx - tx) abs(sx - x) abs sx - x sx x abs(sx - tx) abs sx - tx sx tx d2 = abs(tx - x) + abs(sx - tx) d2 abs(tx - x) + abs(sx - tx) abs(tx - x) abs tx - x tx x abs(sx - tx) abs sx - tx sx tx d = min(d, d1, d2) d min(d, d1, d2) min d d1 d2 print(d) print d d = min(d, d1, d2) min(d, d1, d2) d j = bisect_left(t, x) bisect_left(t, x) j a, b, q = map(int, input().split()) map(int, input().split()) a t = [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] + [INF] t INF = 10 ** 15 10 ** 15 INF d2 = abs(tx - x) + abs(sx - tx) abs(tx - x) + abs(sx - tx) d2 b, q = map(int, input().split()) map(int, input().split()) b x = int(input()) int(input()) x i = bisect_left(s, x) bisect_left(s, x) i s = [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] + [INF] s d = INF INF d q = map(int, input().split()) map(int, input().split()) q d1 = abs(sx - x) + abs(sx - tx) abs(sx - x) + abs(sx - tx) d1
a, b, q = map(int, input().split())
INF = 10 ** 15
s = [-INF] + [int(input()) for _ in range(a)] + [INF] # sorted
t = [-INF] + [int(input()) for _ in range(b)] + [INF] # sorted

from bisect import bisect_left, bisect_right

for _ in range(q):
    x = int(input())
    i = bisect_left(s, x)
    j = bisect_left(t, x)
    d = INF
    for sx in [s[i - 1], s[i]]:
        for tx in [t[j - 1], t[j]]:
            d1 = abs(sx - x) + abs(sx - tx)
            d2 = abs(tx - x) + abs(sx - tx)
            d = min(d, d1, d2)
    print(d)