from bisect import bisect

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

for xi in x:
    p, q = bisect(s, xi), bisect(t, xi)
    sl, sr = abs(s[p - 1] - xi), abs(s[p] - xi)
    tl, tr = abs(t[q - 1] - xi), abs(t[q] - xi)
    ans = min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl))
    print(ans) from bisect import 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 = [-10 ** 11] + [int(input()) for _ in range(a)] + [10 ** 11] s [-10 ** 11] + [int(input()) for _ in range(a)] + [10 ** 11] [-10 ** 11] + [int(input()) for _ in range(a)] [-10 ** 11] -10 ** 11 -10 11 [int(input()) for _ in range(a)] [10 ** 11] 10 ** 11 10 11 int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [-10 ** 11] + [int(input()) for _ in range(b)] + [10 ** 11] t [-10 ** 11] + [int(input()) for _ in range(b)] + [10 ** 11] [-10 ** 11] + [int(input()) for _ in range(b)] [-10 ** 11] -10 ** 11 -10 11 [int(input()) for _ in range(b)] [10 ** 11] 10 ** 11 10 11 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)] for xi in x:
    p, q = bisect(s, xi), bisect(t, xi)
    sl, sr = abs(s[p - 1] - xi), abs(s[p] - xi)
    tl, tr = abs(t[q - 1] - xi), abs(t[q] - xi)
    ans = min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl))
    print(ans) xi x p, q = bisect(s, xi), bisect(t, xi) p bisect(s, xi) bisect s xi q bisect(t, xi) bisect t xi sl, sr = abs(s[p - 1] - xi), abs(s[p] - xi) sl abs(s[p - 1] - xi) abs s[p - 1] - xi s[p - 1] s p - 1 p 1 xi sr abs(s[p] - xi) abs s[p] - xi s[p] s p xi tl, tr = abs(t[q - 1] - xi), abs(t[q] - xi) tl abs(t[q - 1] - xi) abs t[q - 1] - xi t[q - 1] t q - 1 q 1 xi tr abs(t[q] - xi) abs t[q] - xi t[q] t q xi ans = min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl)) ans min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl)) min max(sl, tl) max sl tl sl + tr + min(sl, tr) sl + tr sl tr min(sl, tr) min sl tr max(sr, tr) max sr tr sr + tl + min(sr, tl) sr + tl sr tl min(sr, tl) min sr tl print(ans) print ans p, q = bisect(s, xi), bisect(t, xi) bisect(s, xi) p q = bisect(s, xi), bisect(t, xi) bisect(t, xi) q x = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x b, q = map(int, input().split()) map(int, input().split()) b q = map(int, input().split()) map(int, input().split()) q tr = abs(t[q - 1] - xi), abs(t[q] - xi) abs(t[q] - xi) tr s = [-10 ** 11] + [int(input()) for _ in range(a)] + [10 ** 11] [-10 ** 11] + [int(input()) for _ in range(a)] + [10 ** 11] s ans = min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl)) min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl)) ans sl, sr = abs(s[p - 1] - xi), abs(s[p] - xi) abs(s[p - 1] - xi) sl tl, tr = abs(t[q - 1] - xi), abs(t[q] - xi) abs(t[q - 1] - xi) tl sr = abs(s[p - 1] - xi), abs(s[p] - xi) abs(s[p] - xi) sr a, b, q = map(int, input().split()) map(int, input().split()) a t = [-10 ** 11] + [int(input()) for _ in range(b)] + [10 ** 11] [-10 ** 11] + [int(input()) for _ in range(b)] + [10 ** 11] t
from bisect import bisect

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

for xi in x:
    p, q = bisect(s, xi), bisect(t, xi)
    sl, sr = abs(s[p - 1] - xi), abs(s[p] - xi)
    tl, tr = abs(t[q - 1] - xi), abs(t[q] - xi)
    ans = min(max(sl, tl), sl + tr + min(sl, tr),
              max(sr, tr), sr + tl + min(sr, tl))
    print(ans)
