def abc119_d():
    import sys
    read = sys.stdin.buffer.read
    inp = iter(map(int, read().split()))

    a = next(inp)
    b = next(inp)
    q = next(inp)
    S = [next(inp) for _ in range(a)]
    T = [next(inp) for _ in range(b)]

    from bisect import bisect_left
    inf = 10**12

    for _ in range(q):
        x = next(inp)
        si = bisect_left(S, x)
        ti = bisect_left(T, x)

        sl, sr = inf, inf
        tl, tr = inf, inf
        if 0 < si: sl = x - S[si-1]
        if si < a: sr = S[si] - x
        if 0 < ti: tl = x - T[ti-1]
        if ti < b: tr = T[ti] - x

        ans = inf
        ans = min(ans, max(sl, tl))
        ans = min(ans, max(sr, tr))
        ans = min(ans, 2 * min(sl, tr) + max(sl, tr))
        ans = min(ans, 2 * min(sr, tl) + max(sr, tl))
        print(ans)

if __name__ == '__main__':
    abc119_d() def abc119_d():
    import sys
    read = sys.stdin.buffer.read
    inp = iter(map(int, read().split()))

    a = next(inp)
    b = next(inp)
    q = next(inp)
    S = [next(inp) for _ in range(a)]
    T = [next(inp) for _ in range(b)]

    from bisect import bisect_left
    inf = 10**12

    for _ in range(q):
        x = next(inp)
        si = bisect_left(S, x)
        ti = bisect_left(T, x)

        sl, sr = inf, inf
        tl, tr = inf, inf
        if 0 < si: sl = x - S[si-1]
        if si < a: sr = S[si] - x
        if 0 < ti: tl = x - T[ti-1]
        if ti < b: tr = T[ti] - x

        ans = inf
        ans = min(ans, max(sl, tl))
        ans = min(ans, max(sr, tr))
        ans = min(ans, 2 * min(sl, tr) + max(sl, tr))
        ans = min(ans, 2 * min(sr, tl) + max(sr, tl))
        print(ans) abc119_d import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read inp = iter(map(int, read().split())) inp iter(map(int, read().split())) iter map(int, read().split()) map int read().split() ().split () read split a = next(inp) a next(inp) next inp b = next(inp) b next(inp) next inp q = next(inp) q next(inp) next inp next(inp) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) next(inp) next inp S = [next(inp) for _ in range(a)] S [next(inp) for _ in range(a)] next(inp) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) next(inp) next inp T = [next(inp) for _ in range(b)] T [next(inp) for _ in range(b)] from bisect import bisect_left inf = 10**12 inf 10**12 10 12 for _ in range(q):
        x = next(inp)
        si = bisect_left(S, x)
        ti = bisect_left(T, x)

        sl, sr = inf, inf
        tl, tr = inf, inf
        if 0 < si: sl = x - S[si-1]
        if si < a: sr = S[si] - x
        if 0 < ti: tl = x - T[ti-1]
        if ti < b: tr = T[ti] - x

        ans = inf
        ans = min(ans, max(sl, tl))
        ans = min(ans, max(sr, tr))
        ans = min(ans, 2 * min(sl, tr) + max(sl, tr))
        ans = min(ans, 2 * min(sr, tl) + max(sr, tl))
        print(ans) _ range(q) range q x = next(inp) x next(inp) next inp si = bisect_left(S, x) si bisect_left(S, x) bisect_left S x ti = bisect_left(T, x) ti bisect_left(T, x) bisect_left T x sl, sr = inf, inf sl inf sr inf tl, tr = inf, inf tl inf tr inf if 0 < si: sl = x - S[si-1]
         0 < si 0 si if si < a: sr = S[si] - x
         si < a si a if 0 < ti: tl = x - T[ti-1]
         0 < ti 0 ti if ti < b: tr = T[ti] - x

         ti < b ti b ans = inf ans inf ans = min(ans, max(sl, tl)) ans min(ans, max(sl, tl)) min ans max(sl, tl) max sl tl ans = min(ans, max(sr, tr)) ans min(ans, max(sr, tr)) min ans max(sr, tr) max sr tr ans = min(ans, 2 * min(sl, tr) + max(sl, tr)) ans min(ans, 2 * min(sl, tr) + max(sl, tr)) min ans 2 * min(sl, tr) + max(sl, tr) 2 * min(sl, tr) 2 min(sl, tr) min sl tr max(sl, tr) max sl tr ans = min(ans, 2 * min(sr, tl) + max(sr, tl)) ans min(ans, 2 * min(sr, tl) + max(sr, tl)) min ans 2 * min(sr, tl) + max(sr, tl) 2 * min(sr, tl) 2 min(sr, tl) min sr tl max(sr, tl) max sr tl print(ans) print ans if __name__ == '__main__':
    abc119_d() __name__ == '__main__' __name__ '__main__' abc119_d() abc119_d def abc119_d():
    import sys
    read = sys.stdin.buffer.read
    inp = iter(map(int, read().split()))

    a = next(inp)
    b = next(inp)
    q = next(inp)
    S = [next(inp) for _ in range(a)]
    T = [next(inp) for _ in range(b)]

    from bisect import bisect_left
    inf = 10**12

    for _ in range(q):
        x = next(inp)
        si = bisect_left(S, x)
        ti = bisect_left(T, x)

        sl, sr = inf, inf
        tl, tr = inf, inf
        if 0 < si: sl = x - S[si-1]
        if si < a: sr = S[si] - x
        if 0 < ti: tl = x - T[ti-1]
        if ti < b: tr = T[ti] - x

        ans = inf
        ans = min(ans, max(sl, tl))
        ans = min(ans, max(sr, tr))
        ans = min(ans, 2 * min(sl, tr) + max(sl, tr))
        ans = min(ans, 2 * min(sr, tl) + max(sr, tl))
        print(ans) def abc119_d():
    import sys
    read = sys.stdin.buffer.read
    inp = iter(map(int, read().split()))

    a = next(inp)
    b = next(inp)
    q = next(inp)
    S = [next(inp) for _ in range(a)]
    T = [next(inp) for _ in range(b)]

    from bisect import bisect_left
    inf = 10**12

    for _ in range(q):
        x = next(inp)
        si = bisect_left(S, x)
        ti = bisect_left(T, x)

        sl, sr = inf, inf
        tl, tr = inf, inf
        if 0 < si: sl = x - S[si-1]
        if si < a: sr = S[si] - x
        if 0 < ti: tl = x - T[ti-1]
        if ti < b: tr = T[ti] - x

        ans = inf
        ans = min(ans, max(sl, tl))
        ans = min(ans, max(sr, tr))
        ans = min(ans, 2 * min(sl, tr) + max(sl, tr))
        ans = min(ans, 2 * min(sr, tl) + max(sr, tl))
        print(ans) abc119_d
def abc119_d():
    import sys
    read = sys.stdin.buffer.read
    inp = iter(map(int, read().split()))

    a = next(inp)
    b = next(inp)
    q = next(inp)
    S = [next(inp) for _ in range(a)]
    T = [next(inp) for _ in range(b)]

    from bisect import bisect_left
    inf = 10**12

    for _ in range(q):
        x = next(inp)
        si = bisect_left(S, x)
        ti = bisect_left(T, x)

        sl, sr = inf, inf
        tl, tr = inf, inf
        if 0 < si: sl = x - S[si-1]
        if si < a: sr = S[si] - x
        if 0 < ti: tl = x - T[ti-1]
        if ti < b: tr = T[ti] - x

        ans = inf
        ans = min(ans, max(sl, tl))
        ans = min(ans, max(sr, tr))
        ans = min(ans, 2 * min(sl, tr) + max(sl, tr))
        ans = min(ans, 2 * min(sr, tl) + max(sr, tl))
        print(ans)

if __name__ == '__main__':
    abc119_d()