import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

A,B,Q = LI()
inf = 10**12
s = [-inf]+[I() for _ in range(A)]+[inf]
t = [-inf]+[I() for _ in range(B)]+[inf]
x = [I() for _ in range(Q)]

from bisect import bisect

# xiより東にある神社・寺の中で最も西にあるもの、xiより西にある神社・寺の中で最も東にあるものだけがあると思えばよい

for i in range(Q):
    y = x[i]
    a = bisect(s,y)
    b = bisect(t,y)
    s1,s2,t1,t2 = s[a-1],s[a],t[b-1],t[b]
    z1 = abs(y-s1)+abs(s1-t1)
    z2 = abs(y-s1)+abs(s1-t2)
    z3 = abs(y-s2)+abs(s2-t1)
    z4 = abs(y-s2)+abs(s2-t2)
    z5 = abs(y-t1)+abs(t1-s1)
    z6 = abs(y-t1)+abs(t1-s2)
    z7 = abs(y-t2)+abs(t2-s1)
    z8 = abs(y-t2)+abs(t2-s2)
    print(min(z1,z2,z3,z4,z5,z6,z7,z8)) import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり LI A,B,Q = LI() A LI() LI B Q inf = 10**12 inf 10**12 10 12 I() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) I() I s = [-inf]+[I() for _ in range(A)]+[inf] s [-inf]+[I() for _ in range(A)]+[inf] [-inf]+[I() for _ in range(A)] [-inf] -inf inf [I() for _ in range(A)] [inf] inf I() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) I() I t = [-inf]+[I() for _ in range(B)]+[inf] t [-inf]+[I() for _ in range(B)]+[inf] [-inf]+[I() for _ in range(B)] [-inf] -inf inf [I() for _ in range(B)] [inf] inf I() for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) I() I x = [I() for _ in range(Q)] x [I() for _ in range(Q)] from bisect import bisect for i in range(Q):
    y = x[i]
    a = bisect(s,y)
    b = bisect(t,y)
    s1,s2,t1,t2 = s[a-1],s[a],t[b-1],t[b]
    z1 = abs(y-s1)+abs(s1-t1)
    z2 = abs(y-s1)+abs(s1-t2)
    z3 = abs(y-s2)+abs(s2-t1)
    z4 = abs(y-s2)+abs(s2-t2)
    z5 = abs(y-t1)+abs(t1-s1)
    z6 = abs(y-t1)+abs(t1-s2)
    z7 = abs(y-t2)+abs(t2-s1)
    z8 = abs(y-t2)+abs(t2-s2)
    print(min(z1,z2,z3,z4,z5,z6,z7,z8)) i range(Q) range Q y = x[i] y x[i] x i a = bisect(s,y) a bisect(s,y) bisect s y b = bisect(t,y) b bisect(t,y) bisect t y s1,s2,t1,t2 = s[a-1],s[a],t[b-1],t[b] s1 s[a-1] s a-1 a 1 s2 s[a] s a t1 t[b-1] t b-1 b 1 t2 t[b] t b z1 = abs(y-s1)+abs(s1-t1) z1 abs(y-s1)+abs(s1-t1) abs(y-s1) abs y-s1 y s1 abs(s1-t1) abs s1-t1 s1 t1 z2 = abs(y-s1)+abs(s1-t2) z2 abs(y-s1)+abs(s1-t2) abs(y-s1) abs y-s1 y s1 abs(s1-t2) abs s1-t2 s1 t2 z3 = abs(y-s2)+abs(s2-t1) z3 abs(y-s2)+abs(s2-t1) abs(y-s2) abs y-s2 y s2 abs(s2-t1) abs s2-t1 s2 t1 z4 = abs(y-s2)+abs(s2-t2) z4 abs(y-s2)+abs(s2-t2) abs(y-s2) abs y-s2 y s2 abs(s2-t2) abs s2-t2 s2 t2 z5 = abs(y-t1)+abs(t1-s1) z5 abs(y-t1)+abs(t1-s1) abs(y-t1) abs y-t1 y t1 abs(t1-s1) abs t1-s1 t1 s1 z6 = abs(y-t1)+abs(t1-s2) z6 abs(y-t1)+abs(t1-s2) abs(y-t1) abs y-t1 y t1 abs(t1-s2) abs t1-s2 t1 s2 z7 = abs(y-t2)+abs(t2-s1) z7 abs(y-t2)+abs(t2-s1) abs(y-t2) abs y-t2 y t2 abs(t2-s1) abs t2-s1 t2 s1 z8 = abs(y-t2)+abs(t2-s2) z8 abs(y-t2)+abs(t2-s2) abs(y-t2) abs y-t2 y t2 abs(t2-s2) abs t2-s2 t2 s2 print(min(z1,z2,z3,z4,z5,z6,z7,z8)) print min(z1,z2,z3,z4,z5,z6,z7,z8) min z1 z2 z3 z4 z5 z6 z7 z8 def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I A,B,Q = LI() LI() A z6 = abs(y-t1)+abs(t1-s2) abs(y-t1)+abs(t1-s2) z6 y = x[i] x[i] y s1,s2,t1,t2 = s[a-1],s[a],t[b-1],t[b] s[a-1] s1 B,Q = LI() LI() B z7 = abs(y-t2)+abs(t2-s1) abs(y-t2)+abs(t2-s1) z7 def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり LI z5 = abs(y-t1)+abs(t1-s1) abs(y-t1)+abs(t1-s1) z5 s2,t1,t2 = s[a-1],s[a],t[b-1],t[b] s[a] s2 Q = LI() LI() Q s = [-inf]+[I() for _ in range(A)]+[inf] [-inf]+[I() for _ in range(A)]+[inf] s z2 = abs(y-s1)+abs(s1-t2) abs(y-s1)+abs(s1-t2) z2 z4 = abs(y-s2)+abs(s2-t2) abs(y-s2)+abs(s2-t2) z4 inf = 10**12 10**12 inf t = [-inf]+[I() for _ in range(B)]+[inf] [-inf]+[I() for _ in range(B)]+[inf] t t2 = s[a-1],s[a],t[b-1],t[b] t[b] t2 x = [I() for _ in range(Q)] [I() for _ in range(Q)] x a = bisect(s,y) bisect(s,y) a z8 = abs(y-t2)+abs(t2-s2) abs(y-t2)+abs(t2-s2) z8 b = bisect(t,y) bisect(t,y) b z3 = abs(y-s2)+abs(s2-t1) abs(y-s2)+abs(s2-t1) z3 t1,t2 = s[a-1],s[a],t[b-1],t[b] t[b-1] t1 z1 = abs(y-s1)+abs(s1-t1) abs(y-s1)+abs(s1-t1) z1
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

A,B,Q = LI()
inf = 10**12
s = [-inf]+[I() for _ in range(A)]+[inf]
t = [-inf]+[I() for _ in range(B)]+[inf]
x = [I() for _ in range(Q)]

from bisect import bisect

# xiより東にある神社・寺の中で最も西にあるもの、xiより西にある神社・寺の中で最も東にあるものだけがあると思えばよい

for i in range(Q):
    y = x[i]
    a = bisect(s,y)
    b = bisect(t,y)
    s1,s2,t1,t2 = s[a-1],s[a],t[b-1],t[b]
    z1 = abs(y-s1)+abs(s1-t1)
    z2 = abs(y-s1)+abs(s1-t2)
    z3 = abs(y-s2)+abs(s2-t1)
    z4 = abs(y-s2)+abs(s2-t2)
    z5 = abs(y-t1)+abs(t1-s1)
    z6 = abs(y-t1)+abs(t1-s2)
    z7 = abs(y-t2)+abs(t2-s1)
    z8 = abs(y-t2)+abs(t2-s2)
    print(min(z1,z2,z3,z4,z5,z6,z7,z8))