a,b,q = map(int,input().split())

sl = [-float("inf")]
for _ in range(a):
    sl.append(int(input()))
sl.append(float("inf"))
tl = [-float("inf")]
for _ in range(b):
    tl.append(int(input()))
tl.append(float("inf"))
    
import bisect


for _ in range(q):
    x = int(input())
    index1 = bisect.bisect(sl, x) 
    index2 = bisect.bisect(tl, x)
    rs = abs(sl[index1] - x) 
    ls = abs(sl[index1-1] - x)
    rt = abs(tl[index2] - x)
    lt = abs(tl[index2-1] - x)
    ansl = []
    ansl.append(max(rs,rt))
    ansl.append(max(ls,lt))
    ansl.append(2*min(rs,lt)+max(rs,lt))
    ansl.append(2*min(ls,rt)+max(ls,rt))
    print(min(ansl))
     a,b,q = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q sl = [-float("inf")] sl [-float("inf")] -float("inf") float("inf") float "inf" for _ in range(a):
    sl.append(int(input())) _ range(a) range a sl.append(int(input())) sl.append sl append int(input()) int input() input sl.append(float("inf")) sl.append sl append float("inf") float "inf" tl = [-float("inf")] tl [-float("inf")] -float("inf") float("inf") float "inf" for _ in range(b):
    tl.append(int(input())) _ range(b) range b tl.append(int(input())) tl.append tl append int(input()) int input() input tl.append(float("inf")) tl.append tl append float("inf") float "inf" import bisect bisect for _ in range(q):
    x = int(input())
    index1 = bisect.bisect(sl, x) 
    index2 = bisect.bisect(tl, x)
    rs = abs(sl[index1] - x) 
    ls = abs(sl[index1-1] - x)
    rt = abs(tl[index2] - x)
    lt = abs(tl[index2-1] - x)
    ansl = []
    ansl.append(max(rs,rt))
    ansl.append(max(ls,lt))
    ansl.append(2*min(rs,lt)+max(rs,lt))
    ansl.append(2*min(ls,rt)+max(ls,rt))
    print(min(ansl))
     _ range(q) range q x = int(input()) x int(input()) int input() input index1 = bisect.bisect(sl, x) index1 bisect.bisect(sl, x) bisect.bisect bisect bisect sl x index2 = bisect.bisect(tl, x) index2 bisect.bisect(tl, x) bisect.bisect bisect bisect tl x rs = abs(sl[index1] - x) rs abs(sl[index1] - x) abs sl[index1] - x sl[index1] sl index1 x ls = abs(sl[index1-1] - x) ls abs(sl[index1-1] - x) abs sl[index1-1] - x sl[index1-1] sl index1-1 index1 1 x rt = abs(tl[index2] - x) rt abs(tl[index2] - x) abs tl[index2] - x tl[index2] tl index2 x lt = abs(tl[index2-1] - x) lt abs(tl[index2-1] - x) abs tl[index2-1] - x tl[index2-1] tl index2-1 index2 1 x ansl = [] ansl [] ansl.append(max(rs,rt)) ansl.append ansl append max(rs,rt) max rs rt ansl.append(max(ls,lt)) ansl.append ansl append max(ls,lt) max ls lt ansl.append(2*min(rs,lt)+max(rs,lt)) ansl.append ansl append 2*min(rs,lt)+max(rs,lt) 2*min(rs,lt) 2 min(rs,lt) min rs lt max(rs,lt) max rs lt ansl.append(2*min(ls,rt)+max(ls,rt)) ansl.append ansl append 2*min(ls,rt)+max(ls,rt) 2*min(ls,rt) 2 min(ls,rt) min ls rt max(ls,rt) max ls rt print(min(ansl)) print min(ansl) min ansl q = map(int,input().split()) map(int,input().split()) q lt = abs(tl[index2-1] - x) abs(tl[index2-1] - x) lt b,q = map(int,input().split()) map(int,input().split()) b index1 = bisect.bisect(sl, x) bisect.bisect(sl, x) index1 ls = abs(sl[index1-1] - x) abs(sl[index1-1] - x) ls x = int(input()) int(input()) x tl = [-float("inf")] [-float("inf")] tl ansl = [] [] ansl rs = abs(sl[index1] - x) abs(sl[index1] - x) rs index2 = bisect.bisect(tl, x) bisect.bisect(tl, x) index2 rt = abs(tl[index2] - x) abs(tl[index2] - x) rt a,b,q = map(int,input().split()) map(int,input().split()) a sl = [-float("inf")] [-float("inf")] sl
a,b,q = map(int,input().split())

sl = [-float("inf")]
for _ in range(a):
    sl.append(int(input()))
sl.append(float("inf"))
tl = [-float("inf")]
for _ in range(b):
    tl.append(int(input()))
tl.append(float("inf"))
    
import bisect


for _ in range(q):
    x = int(input())
    index1 = bisect.bisect(sl, x) 
    index2 = bisect.bisect(tl, x)
    rs = abs(sl[index1] - x) 
    ls = abs(sl[index1-1] - x)
    rt = abs(tl[index2] - x)
    lt = abs(tl[index2-1] - x)
    ansl = []
    ansl.append(max(rs,rt))
    ansl.append(max(ls,lt))
    ansl.append(2*min(rs,lt)+max(rs,lt))
    ansl.append(2*min(ls,rt)+max(ls,rt))
    print(min(ansl))
    
