a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
x=[int(input()) for i in range(q)]

from bisect import bisect

for i in range(q):
    y=bisect(s,x[i])
    z=bisect(t,x[i])
    k=([0] if y==0 else [a-1] if y==a else [y-1,y])
    l=([0] if z==0 else [b-1] if z==b else [z-1,z])
    mi=100000000000000
    for n in k:
        for m in l:
            if abs(s[n]-x[i])>abs(t[m]-x[i]):
                sub1,sub2=t[m],s[n]
            else:
                sub1,sub2=s[n],t[m]
            mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1))
    print(mi) a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q int(input()) for i in range(a) for i in range(a) i range(a) range a for i in range(a) int(input()) int input() input s=[int(input()) for i in range(a)] s [int(input()) for i in range(a)] int(input()) for i in range(b) for i in range(b) i range(b) range b for i in range(b) int(input()) int input() input t=[int(input()) for i in range(b)] t [int(input()) for i in range(b)] int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input x=[int(input()) for i in range(q)] x [int(input()) for i in range(q)] from bisect import bisect for i in range(q):
    y=bisect(s,x[i])
    z=bisect(t,x[i])
    k=([0] if y==0 else [a-1] if y==a else [y-1,y])
    l=([0] if z==0 else [b-1] if z==b else [z-1,z])
    mi=100000000000000
    for n in k:
        for m in l:
            if abs(s[n]-x[i])>abs(t[m]-x[i]):
                sub1,sub2=t[m],s[n]
            else:
                sub1,sub2=s[n],t[m]
            mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1))
    print(mi) i range(q) range q y=bisect(s,x[i]) y bisect(s,x[i]) bisect s x[i] x i z=bisect(t,x[i]) z bisect(t,x[i]) bisect t x[i] x i k=([0] if y==0 else [a-1] if y==a else [y-1,y]) k [0] if y==0 else [a-1] if y==a else [y-1,y] y==0 y 0 [0] 0 [a-1] if y==a else [y-1,y] y==a y a [a-1] a-1 a 1 [y-1,y] y-1 y 1 y l=([0] if z==0 else [b-1] if z==b else [z-1,z]) l [0] if z==0 else [b-1] if z==b else [z-1,z] z==0 z 0 [0] 0 [b-1] if z==b else [z-1,z] z==b z b [b-1] b-1 b 1 [z-1,z] z-1 z 1 z mi=100000000000000 mi 100000000000000 for n in k:
        for m in l:
            if abs(s[n]-x[i])>abs(t[m]-x[i]):
                sub1,sub2=t[m],s[n]
            else:
                sub1,sub2=s[n],t[m]
            mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1))
     n k for m in l:
            if abs(s[n]-x[i])>abs(t[m]-x[i]):
                sub1,sub2=t[m],s[n]
            else:
                sub1,sub2=s[n],t[m]
            mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1))
     m l if abs(s[n]-x[i])>abs(t[m]-x[i]):
                sub1,sub2=t[m],s[n]
            else:
                sub1,sub2=s[n],t[m]
             abs(s[n]-x[i])>abs(t[m]-x[i]) abs(s[n]-x[i]) abs s[n]-x[i] s[n] s n x[i] x i abs(t[m]-x[i]) abs t[m]-x[i] t[m] t m x[i] x i sub1,sub2=t[m],s[n] sub1 t[m] t m sub2 s[n] s n sub1,sub2=s[n],t[m] sub1 s[n] s n sub2 t[m] t m mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1)) mi min(mi,abs(sub1-x[i])+abs(sub2-sub1)) min mi abs(sub1-x[i])+abs(sub2-sub1) abs(sub1-x[i]) abs sub1-x[i] sub1 x[i] x i abs(sub2-sub1) abs sub2-sub1 sub2 sub1 print(mi) print mi t=[int(input()) for i in range(b)] [int(input()) for i in range(b)] t sub2=t[m],s[n] s[n] sub2 y=bisect(s,x[i]) bisect(s,x[i]) y mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1)) min(mi,abs(sub1-x[i])+abs(sub2-sub1)) mi k=([0] if y==0 else [a-1] if y==a else [y-1,y]) [0] if y==0 else [a-1] if y==a else [y-1,y] k b,q=map(int,input().split()) map(int,input().split()) b sub2=s[n],t[m] t[m] sub2 a,b,q=map(int,input().split()) map(int,input().split()) a l=([0] if z==0 else [b-1] if z==b else [z-1,z]) [0] if z==0 else [b-1] if z==b else [z-1,z] l sub1,sub2=t[m],s[n] t[m] sub1 q=map(int,input().split()) map(int,input().split()) q sub1,sub2=s[n],t[m] s[n] sub1 s=[int(input()) for i in range(a)] [int(input()) for i in range(a)] s x=[int(input()) for i in range(q)] [int(input()) for i in range(q)] x mi=100000000000000 100000000000000 mi z=bisect(t,x[i]) bisect(t,x[i]) z
a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
x=[int(input()) for i in range(q)]

from bisect import bisect

for i in range(q):
    y=bisect(s,x[i])
    z=bisect(t,x[i])
    k=([0] if y==0 else [a-1] if y==a else [y-1,y])
    l=([0] if z==0 else [b-1] if z==b else [z-1,z])
    mi=100000000000000
    for n in k:
        for m in l:
            if abs(s[n]-x[i])>abs(t[m]-x[i]):
                sub1,sub2=t[m],s[n]
            else:
                sub1,sub2=s[n],t[m]
            mi=min(mi,abs(sub1-x[i])+abs(sub2-sub1))
    print(mi)