from bisect import bisect_left
from itertools import product
from sys import maxsize

a, b, q = map(int, input().split())
s = [-maxsize] + [int(input()) for _ in range(a)] + [maxsize]
t = [-maxsize] + [int(input()) for _ in range(b)] + [maxsize]

for _ in range(q):
    x = int(input())
    i = bisect_left(s, x)
    j = bisect_left(t, x)
    res = maxsize
    for ss, tt in product((s[i-1], s[i]), (t[j-1], t[j])):
        res = min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt))
    print(res) from bisect import bisect_left from itertools import product from sys import maxsize 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 = [-maxsize] + [int(input()) for _ in range(a)] + [maxsize] s [-maxsize] + [int(input()) for _ in range(a)] + [maxsize] [-maxsize] + [int(input()) for _ in range(a)] [-maxsize] -maxsize maxsize [int(input()) for _ in range(a)] [maxsize] maxsize int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [-maxsize] + [int(input()) for _ in range(b)] + [maxsize] t [-maxsize] + [int(input()) for _ in range(b)] + [maxsize] [-maxsize] + [int(input()) for _ in range(b)] [-maxsize] -maxsize maxsize [int(input()) for _ in range(b)] [maxsize] maxsize for _ in range(q):
    x = int(input())
    i = bisect_left(s, x)
    j = bisect_left(t, x)
    res = maxsize
    for ss, tt in product((s[i-1], s[i]), (t[j-1], t[j])):
        res = min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt))
    print(res) _ 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 res = maxsize res maxsize for ss, tt in product((s[i-1], s[i]), (t[j-1], t[j])):
        res = min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt))
     ss tt product((s[i-1], s[i]), (t[j-1], t[j])) product (s[i-1], s[i]) s[i-1] s i-1 i 1 s[i] s i (t[j-1], t[j]) t[j-1] t j-1 j 1 t[j] t j res = min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt)) res min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt)) min res abs(ss-x)+abs(tt-ss) abs(ss-x) abs ss-x ss x abs(tt-ss) abs tt-ss tt ss abs(tt-x)+abs(ss-tt) abs(tt-x) abs tt-x tt x abs(ss-tt) abs ss-tt ss tt print(res) print res j = bisect_left(t, x) bisect_left(t, x) j b, q = map(int, input().split()) map(int, input().split()) b s = [-maxsize] + [int(input()) for _ in range(a)] + [maxsize] [-maxsize] + [int(input()) for _ in range(a)] + [maxsize] s i = bisect_left(s, x) bisect_left(s, x) i 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()) int(input()) x t = [-maxsize] + [int(input()) for _ in range(b)] + [maxsize] [-maxsize] + [int(input()) for _ in range(b)] + [maxsize] t res = min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt)) min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt)) res res = maxsize maxsize res
from bisect import bisect_left
from itertools import product
from sys import maxsize

a, b, q = map(int, input().split())
s = [-maxsize] + [int(input()) for _ in range(a)] + [maxsize]
t = [-maxsize] + [int(input()) for _ in range(b)] + [maxsize]

for _ in range(q):
    x = int(input())
    i = bisect_left(s, x)
    j = bisect_left(t, x)
    res = maxsize
    for ss, tt in product((s[i-1], s[i]), (t[j-1], t[j])):
        res = min(res, abs(ss-x)+abs(tt-ss), abs(tt-x)+abs(ss-tt))
    print(res)
