import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B, Q = mapint()
Ss = [-10**18]+[int(input()) for _ in range(A)]+[10**18]
Ts = [-10**18]+[int(input()) for _ in range(B)]+[10**18]
from bisect import bisect_left

for q in range(Q):
    x = int(input())
    ls = Ss[bisect_left(Ss, x)-1]
    lt = Ts[bisect_left(Ts, x)-1]
    rs = Ss[bisect_left(Ss, x)]
    rt = Ts[bisect_left(Ts, x)]
    print(min((rs-lt)+min(rs-x, x-lt), (rt-ls)+min(rt-x, x-ls), max(x-ls, x-lt), max(rs-x, rt-x))) import sys sys def input(): return sys.stdin.readline().strip() input def mapint(): return map(int, input().split()) mapint sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 A, B, Q = mapint() A mapint() mapint 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 Ss = [-10**18]+[int(input()) for _ in range(A)]+[10**18] Ss [-10**18]+[int(input()) for _ in range(A)]+[10**18] [-10**18]+[int(input()) for _ in range(A)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(A)] [10**18] 10**18 10 18 int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input Ts = [-10**18]+[int(input()) for _ in range(B)]+[10**18] Ts [-10**18]+[int(input()) for _ in range(B)]+[10**18] [-10**18]+[int(input()) for _ in range(B)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(B)] [10**18] 10**18 10 18 from bisect import bisect_left for q in range(Q):
    x = int(input())
    ls = Ss[bisect_left(Ss, x)-1]
    lt = Ts[bisect_left(Ts, x)-1]
    rs = Ss[bisect_left(Ss, x)]
    rt = Ts[bisect_left(Ts, x)]
    print(min((rs-lt)+min(rs-x, x-lt), (rt-ls)+min(rt-x, x-ls), max(x-ls, x-lt), max(rs-x, rt-x))) q range(Q) range Q x = int(input()) x int(input()) int input() input ls = Ss[bisect_left(Ss, x)-1] ls Ss[bisect_left(Ss, x)-1] Ss bisect_left(Ss, x)-1 bisect_left(Ss, x) bisect_left Ss x 1 lt = Ts[bisect_left(Ts, x)-1] lt Ts[bisect_left(Ts, x)-1] Ts bisect_left(Ts, x)-1 bisect_left(Ts, x) bisect_left Ts x 1 rs = Ss[bisect_left(Ss, x)] rs Ss[bisect_left(Ss, x)] Ss bisect_left(Ss, x) bisect_left Ss x rt = Ts[bisect_left(Ts, x)] rt Ts[bisect_left(Ts, x)] Ts bisect_left(Ts, x) bisect_left Ts x print(min((rs-lt)+min(rs-x, x-lt), (rt-ls)+min(rt-x, x-ls), max(x-ls, x-lt), max(rs-x, rt-x))) print min((rs-lt)+min(rs-x, x-lt), (rt-ls)+min(rt-x, x-ls), max(x-ls, x-lt), max(rs-x, rt-x)) min (rs-lt)+min(rs-x, x-lt) rs-lt rs lt min(rs-x, x-lt) min rs-x rs x x-lt x lt (rt-ls)+min(rt-x, x-ls) rt-ls rt ls min(rt-x, x-ls) min rt-x rt x x-ls x ls max(x-ls, x-lt) max x-ls x ls x-lt x lt max(rs-x, rt-x) max rs-x rs x rt-x rt x rt = Ts[bisect_left(Ts, x)] Ts[bisect_left(Ts, x)] rt Ts = [-10**18]+[int(input()) for _ in range(B)]+[10**18] [-10**18]+[int(input()) for _ in range(B)]+[10**18] Ts x = int(input()) int(input()) x Ss = [-10**18]+[int(input()) for _ in range(A)]+[10**18] [-10**18]+[int(input()) for _ in range(A)]+[10**18] Ss def mapint(): return map(int, input().split()) def mapint(): return map(int, input().split()) mapint B, Q = mapint() mapint() B rs = Ss[bisect_left(Ss, x)] Ss[bisect_left(Ss, x)] rs def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input ls = Ss[bisect_left(Ss, x)-1] Ss[bisect_left(Ss, x)-1] ls A, B, Q = mapint() mapint() A Q = mapint() mapint() Q lt = Ts[bisect_left(Ts, x)-1] Ts[bisect_left(Ts, x)-1] lt
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B, Q = mapint()
Ss = [-10**18]+[int(input()) for _ in range(A)]+[10**18]
Ts = [-10**18]+[int(input()) for _ in range(B)]+[10**18]
from bisect import bisect_left

for q in range(Q):
    x = int(input())
    ls = Ss[bisect_left(Ss, x)-1]
    lt = Ts[bisect_left(Ts, x)-1]
    rs = Ss[bisect_left(Ss, x)]
    rt = Ts[bisect_left(Ts, x)]
    print(min((rs-lt)+min(rs-x, x-lt), (rt-ls)+min(rt-x, x-ls), max(x-ls, x-lt), max(rs-x, rt-x)))