#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

def main():
    A, B, Q = map(int, input().split())
    a = [int(input()) for _ in range(A)]
    b = [int(input()) for _ in range(B)]
    q = [int(input()) for _ in range(Q)]
    INF = 2*10**10
    a = [-INF] + a + [INF]
    b = [-INF] + b + [INF]

    for x in q:
        ai = bisect_left(a, x)
        ap = a[ai]-x
        am = x-a[ai-1]
        bi = bisect_left(b, x)
        bp = b[bi]-x
        bm = x-b[bi-1]

        ret = INF
        if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
        if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
        ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap)
        print(ret)

if __name__ == '__main__':
    main() from bisect import bisect_left, bisect_right def main():
    A, B, Q = map(int, input().split())
    a = [int(input()) for _ in range(A)]
    b = [int(input()) for _ in range(B)]
    q = [int(input()) for _ in range(Q)]
    INF = 2*10**10
    a = [-INF] + a + [INF]
    b = [-INF] + b + [INF]

    for x in q:
        ai = bisect_left(a, x)
        ap = a[ai]-x
        am = x-a[ai-1]
        bi = bisect_left(b, x)
        bp = b[bi]-x
        bm = x-b[bi-1]

        ret = INF
        if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
        if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
        ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap)
        print(ret) main A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split 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 a = [int(input()) for _ in range(A)] a [int(input()) for _ in range(A)] int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input b = [int(input()) for _ in range(B)] b [int(input()) for _ in range(B)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input q = [int(input()) for _ in range(Q)] q [int(input()) for _ in range(Q)] INF = 2*10**10 INF 2*10**10 2 10**10 10 10 a = [-INF] + a + [INF] a [-INF] + a + [INF] [-INF] + a [-INF] -INF INF a [INF] INF b = [-INF] + b + [INF] b [-INF] + b + [INF] [-INF] + b [-INF] -INF INF b [INF] INF for x in q:
        ai = bisect_left(a, x)
        ap = a[ai]-x
        am = x-a[ai-1]
        bi = bisect_left(b, x)
        bp = b[bi]-x
        bm = x-b[bi-1]

        ret = INF
        if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
        if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
        ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap)
        print(ret) x q ai = bisect_left(a, x) ai bisect_left(a, x) bisect_left a x ap = a[ai]-x ap a[ai]-x a[ai] a ai x am = x-a[ai-1] am x-a[ai-1] x a[ai-1] a ai-1 ai 1 bi = bisect_left(b, x) bi bisect_left(b, x) bisect_left b x bp = b[bi]-x bp b[bi]-x b[bi] b bi x bm = x-b[bi-1] bm x-b[bi-1] x b[bi-1] b bi-1 bi 1 ret = INF ret INF if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
         max(ap,bp)<INF max(ap,bp) max ap bp INF ret = min(ret, max(ap, bp)) ret min(ret, max(ap, bp)) min ret max(ap, bp) max ap bp if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
         max(am,bm)<INF max(am,bm) max am bm INF ret = min(ret, max(am, bm)) ret min(ret, max(am, bm)) min ret max(am, bm) max am bm ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap) ret min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap) min ret ap+2*bm ap 2*bm 2 bm am+2*bp am 2*bp 2 bp bp+2*am bp 2*am 2 am bm+2*ap bm 2*ap 2 ap print(ret) print ret if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    A, B, Q = map(int, input().split())
    a = [int(input()) for _ in range(A)]
    b = [int(input()) for _ in range(B)]
    q = [int(input()) for _ in range(Q)]
    INF = 2*10**10
    a = [-INF] + a + [INF]
    b = [-INF] + b + [INF]

    for x in q:
        ai = bisect_left(a, x)
        ap = a[ai]-x
        am = x-a[ai-1]
        bi = bisect_left(b, x)
        bp = b[bi]-x
        bm = x-b[bi-1]

        ret = INF
        if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
        if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
        ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap)
        print(ret) def main():
    A, B, Q = map(int, input().split())
    a = [int(input()) for _ in range(A)]
    b = [int(input()) for _ in range(B)]
    q = [int(input()) for _ in range(Q)]
    INF = 2*10**10
    a = [-INF] + a + [INF]
    b = [-INF] + b + [INF]

    for x in q:
        ai = bisect_left(a, x)
        ap = a[ai]-x
        am = x-a[ai-1]
        bi = bisect_left(b, x)
        bp = b[bi]-x
        bm = x-b[bi-1]

        ret = INF
        if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
        if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
        ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap)
        print(ret) main
#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

def main():
    A, B, Q = map(int, input().split())
    a = [int(input()) for _ in range(A)]
    b = [int(input()) for _ in range(B)]
    q = [int(input()) for _ in range(Q)]
    INF = 2*10**10
    a = [-INF] + a + [INF]
    b = [-INF] + b + [INF]

    for x in q:
        ai = bisect_left(a, x)
        ap = a[ai]-x
        am = x-a[ai-1]
        bi = bisect_left(b, x)
        bp = b[bi]-x
        bm = x-b[bi-1]

        ret = INF
        if max(ap,bp)<INF:
            ret = min(ret, max(ap, bp))
        if max(am,bm)<INF:
            ret = min(ret, max(am, bm))
        ret = min(ret, ap+2*bm, am+2*bp, bp+2*am, bm+2*ap)
        print(ret)

if __name__ == '__main__':
    main()