from sys import stdin
import bisect
def main():
    #入力
    readline=stdin.readline
    inf=10**18
    a,b,q=map(int,readline().split())
    s=[int(readline()) for _ in range(a)]
    s.insert(0,-inf)
    s.append(inf)
    t=[int(readline()) for _ in range(b)]
    t.insert(0,-inf)
    t.append(inf)
    x=[int(readline()) for _ in range(q)]

    for i in range(q):
        j=bisect.bisect_left(s,x[i])
        k=bisect.bisect_left(t,x[i])
        s_i=(s[j-1],s[j])
        t_i=(t[k-1],t[k])
        ans=float("inf")
        for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

        for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

        print(ans)

if __name__=="__main__":
    main() from sys import stdin import bisect bisect def main():
    #入力
    readline=stdin.readline
    inf=10**18
    a,b,q=map(int,readline().split())
    s=[int(readline()) for _ in range(a)]
    s.insert(0,-inf)
    s.append(inf)
    t=[int(readline()) for _ in range(b)]
    t.insert(0,-inf)
    t.append(inf)
    x=[int(readline()) for _ in range(q)]

    for i in range(q):
        j=bisect.bisect_left(s,x[i])
        k=bisect.bisect_left(t,x[i])
        s_i=(s[j-1],s[j])
        t_i=(t[k-1],t[k])
        ans=float("inf")
        for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

        for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

        print(ans) main readline=stdin.readline readline stdin.readline stdin readline inf=10**18 inf 10**18 10 18 a,b,q=map(int,readline().split()) a map(int,readline().split()) map int readline().split() ().split () readline split b q int(readline()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(readline()) int readline() readline s=[int(readline()) for _ in range(a)] s [int(readline()) for _ in range(a)] s.insert(0,-inf) s.insert s insert 0 -inf inf s.append(inf) s.append s append inf int(readline()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(readline()) int readline() readline t=[int(readline()) for _ in range(b)] t [int(readline()) for _ in range(b)] t.insert(0,-inf) t.insert t insert 0 -inf inf t.append(inf) t.append t append inf int(readline()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(readline()) int readline() readline x=[int(readline()) for _ in range(q)] x [int(readline()) for _ in range(q)] for i in range(q):
        j=bisect.bisect_left(s,x[i])
        k=bisect.bisect_left(t,x[i])
        s_i=(s[j-1],s[j])
        t_i=(t[k-1],t[k])
        ans=float("inf")
        for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

        for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

        print(ans) i range(q) range q j=bisect.bisect_left(s,x[i]) j bisect.bisect_left(s,x[i]) bisect.bisect_left bisect bisect_left s x[i] x i k=bisect.bisect_left(t,x[i]) k bisect.bisect_left(t,x[i]) bisect.bisect_left bisect bisect_left t x[i] x i s_i=(s[j-1],s[j]) s_i (s[j-1],s[j]) s[j-1] s j-1 j 1 s[j] s j t_i=(t[k-1],t[k]) t_i (t[k-1],t[k]) t[k-1] t k-1 k 1 t[k] t k ans=float("inf") ans float("inf") float "inf" for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

         u s_i for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

         v t_i ans=min(ans,abs(u-x[i])+abs(v-u)) ans min(ans,abs(u-x[i])+abs(v-u)) min ans abs(u-x[i])+abs(v-u) abs(u-x[i]) abs u-x[i] u x[i] x i abs(v-u) abs v-u v u for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

         v t_i for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

         u s_i ans=min(ans,abs(v-x[i])+abs(u-v)) ans min(ans,abs(v-x[i])+abs(u-v)) min ans abs(v-x[i])+abs(u-v) abs(v-x[i]) abs v-x[i] v x[i] x i abs(u-v) abs u-v u v print(ans) print ans if __name__=="__main__":
    main() __name__=="__main__" __name__ "__main__" main() main def main():
    #入力
    readline=stdin.readline
    inf=10**18
    a,b,q=map(int,readline().split())
    s=[int(readline()) for _ in range(a)]
    s.insert(0,-inf)
    s.append(inf)
    t=[int(readline()) for _ in range(b)]
    t.insert(0,-inf)
    t.append(inf)
    x=[int(readline()) for _ in range(q)]

    for i in range(q):
        j=bisect.bisect_left(s,x[i])
        k=bisect.bisect_left(t,x[i])
        s_i=(s[j-1],s[j])
        t_i=(t[k-1],t[k])
        ans=float("inf")
        for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

        for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

        print(ans) def main():
    #入力
    readline=stdin.readline
    inf=10**18
    a,b,q=map(int,readline().split())
    s=[int(readline()) for _ in range(a)]
    s.insert(0,-inf)
    s.append(inf)
    t=[int(readline()) for _ in range(b)]
    t.insert(0,-inf)
    t.append(inf)
    x=[int(readline()) for _ in range(q)]

    for i in range(q):
        j=bisect.bisect_left(s,x[i])
        k=bisect.bisect_left(t,x[i])
        s_i=(s[j-1],s[j])
        t_i=(t[k-1],t[k])
        ans=float("inf")
        for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

        for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

        print(ans) main
from sys import stdin
import bisect
def main():
    #入力
    readline=stdin.readline
    inf=10**18
    a,b,q=map(int,readline().split())
    s=[int(readline()) for _ in range(a)]
    s.insert(0,-inf)
    s.append(inf)
    t=[int(readline()) for _ in range(b)]
    t.insert(0,-inf)
    t.append(inf)
    x=[int(readline()) for _ in range(q)]

    for i in range(q):
        j=bisect.bisect_left(s,x[i])
        k=bisect.bisect_left(t,x[i])
        s_i=(s[j-1],s[j])
        t_i=(t[k-1],t[k])
        ans=float("inf")
        for u in s_i:
            for v in t_i:
                ans=min(ans,abs(u-x[i])+abs(v-u))

        for v in t_i:
            for u in s_i:
                ans=min(ans,abs(v-x[i])+abs(u-v))

        print(ans)

if __name__=="__main__":
    main()