import bisect

a, b, q = map(int, input().split())
INF = float('inf')
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
x = [int(input()) for _ in range(q)]

for i in x:
    si = bisect.bisect_left(s, i)
    ti = bisect.bisect_left(t, i)
    sl, sr = i-s[si-1], s[si]-i
    tl, tr = i-t[ti-1], t[ti]-i
    print(min(max(sl,tl), sl+tr+min(sl,tr), sr+tl+min(sr,tl), max(sr,tr))) import bisect bisect a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q INF = float('inf') INF float('inf') float 'inf' 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 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 i in x:
    si = bisect.bisect_left(s, i)
    ti = bisect.bisect_left(t, i)
    sl, sr = i-s[si-1], s[si]-i
    tl, tr = i-t[ti-1], t[ti]-i
    print(min(max(sl,tl), sl+tr+min(sl,tr), sr+tl+min(sr,tl), max(sr,tr))) i x si = bisect.bisect_left(s, i) si bisect.bisect_left(s, i) bisect.bisect_left bisect bisect_left s i ti = bisect.bisect_left(t, i) ti bisect.bisect_left(t, i) bisect.bisect_left bisect bisect_left t i sl, sr = i-s[si-1], s[si]-i sl i-s[si-1] i s[si-1] s si-1 si 1 sr s[si]-i s[si] s si i tl, tr = i-t[ti-1], t[ti]-i tl i-t[ti-1] i t[ti-1] t ti-1 ti 1 tr t[ti]-i t[ti] t ti i print(min(max(sl,tl), sl+tr+min(sl,tr), sr+tl+min(sr,tl), max(sr,tr))) print min(max(sl,tl), sl+tr+min(sl,tr), sr+tl+min(sr,tl), max(sr,tr)) min max(sl,tl) max sl tl sl+tr+min(sl,tr) sl+tr sl tr min(sl,tr) min sl tr sr+tl+min(sr,tl) sr+tl sr tl min(sr,tl) min sr tl max(sr,tr) max sr tr sr = i-s[si-1], s[si]-i s[si]-i sr ti = bisect.bisect_left(t, i) bisect.bisect_left(t, i) ti b, q = map(int, input().split()) map(int, input().split()) b s = [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] + [INF] s a, b, q = map(int, input().split()) map(int, input().split()) a q = map(int, input().split()) map(int, input().split()) q tl, tr = i-t[ti-1], t[ti]-i i-t[ti-1] tl si = bisect.bisect_left(s, i) bisect.bisect_left(s, i) si sl, sr = i-s[si-1], s[si]-i i-s[si-1] sl t = [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] + [INF] t tr = i-t[ti-1], t[ti]-i t[ti]-i tr INF = float('inf') float('inf') INF x = [int(input()) for _ in range(q)] [int(input()) for _ in range(q)] x
import bisect

a, b, q = map(int, input().split())
INF = float('inf')
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
x = [int(input()) for _ in range(q)]

for i in x:
    si = bisect.bisect_left(s, i)
    ti = bisect.bisect_left(t, i)
    sl, sr = i-s[si-1], s[si]-i
    tl, tr = i-t[ti-1], t[ti]-i
    print(min(max(sl,tl), sl+tr+min(sl,tr), sr+tl+min(sr,tl), max(sr,tr)))