import sys
import bisect
input = sys.stdin.readline

A, B, Q = map(int, input().split())
tera = [int(input()) for _ in range(A)]
sha = [int(input()) for _ in range(B)]
query = [int(input()) for _ in range(Q)]
res = []

for x in query:
    tl = bisect.bisect_left(tera, x)
    tr = bisect.bisect_right(tera, x)
    sl = bisect.bisect_left(sha, x)
    sr = bisect.bisect_right(sha, x)

    if tl == 0:
        temple = [tera[0]]
    elif tr == A:
        temple = [tera[A - 1]]
    else:
        temple = [tera[tl-1], tera[tl]]

    if sl == 0:
        shrine = [sha[0]]
    elif sr == B:
        shrine = [sha[B - 1]]
    else:
        shrine = [sha[sl-1], sha[sl]]

    ans = 10**18
    for t in temple:
        for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
    res.append(ans)

print(*res, sep="\n") import sys sys import bisect bisect input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 tera = [int(input()) for _ in range(A)] tera [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 sha = [int(input()) for _ in range(B)] sha [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 query = [int(input()) for _ in range(Q)] query [int(input()) for _ in range(Q)] res = [] res [] for x in query:
    tl = bisect.bisect_left(tera, x)
    tr = bisect.bisect_right(tera, x)
    sl = bisect.bisect_left(sha, x)
    sr = bisect.bisect_right(sha, x)

    if tl == 0:
        temple = [tera[0]]
    elif tr == A:
        temple = [tera[A - 1]]
    else:
        temple = [tera[tl-1], tera[tl]]

    if sl == 0:
        shrine = [sha[0]]
    elif sr == B:
        shrine = [sha[B - 1]]
    else:
        shrine = [sha[sl-1], sha[sl]]

    ans = 10**18
    for t in temple:
        for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
    res.append(ans) x query tl = bisect.bisect_left(tera, x) tl bisect.bisect_left(tera, x) bisect.bisect_left bisect bisect_left tera x tr = bisect.bisect_right(tera, x) tr bisect.bisect_right(tera, x) bisect.bisect_right bisect bisect_right tera x sl = bisect.bisect_left(sha, x) sl bisect.bisect_left(sha, x) bisect.bisect_left bisect bisect_left sha x sr = bisect.bisect_right(sha, x) sr bisect.bisect_right(sha, x) bisect.bisect_right bisect bisect_right sha x if tl == 0:
        temple = [tera[0]]
    elif tr == A:
        temple = [tera[A - 1]]
    else:
        temple = [tera[tl-1], tera[tl]]

     tl == 0 tl 0 temple = [tera[0]] temple [tera[0]] tera[0] tera 0 elif tr == A:
        temple = [tera[A - 1]]
     tr == A tr A temple = [tera[A - 1]] temple [tera[A - 1]] tera[A - 1] tera A - 1 A 1 temple = [tera[tl-1], tera[tl]] temple [tera[tl-1], tera[tl]] tera[tl-1] tera tl-1 tl 1 tera[tl] tera tl if sl == 0:
        shrine = [sha[0]]
    elif sr == B:
        shrine = [sha[B - 1]]
    else:
        shrine = [sha[sl-1], sha[sl]]

     sl == 0 sl 0 shrine = [sha[0]] shrine [sha[0]] sha[0] sha 0 elif sr == B:
        shrine = [sha[B - 1]]
     sr == B sr B shrine = [sha[B - 1]] shrine [sha[B - 1]] sha[B - 1] sha B - 1 B 1 shrine = [sha[sl-1], sha[sl]] shrine [sha[sl-1], sha[sl]] sha[sl-1] sha sl-1 sl 1 sha[sl] sha sl ans = 10**18 ans 10**18 10 18 for t in temple:
        for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
     t temple for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
     s shrine tx = t - x tx t - x t x sx = s - x sx s - x s x if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
             tx * sx >= 0 tx * sx tx sx 0 a = max(abs(tx), abs(sx)) a max(abs(tx), abs(sx)) max abs(tx) abs tx abs(sx) abs sx a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx)) a min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx)) min 2 * abs(tx) + abs(sx) 2 * abs(tx) 2 abs(tx) abs tx abs(sx) abs sx 2 * abs(sx) + abs(tx) 2 * abs(sx) 2 abs(sx) abs sx abs(tx) abs tx ans = min(ans, a) ans min(ans, a) min ans a res.append(ans) res.append res append ans print(*res, sep="\n") print *res res sep="\n" sep "\n" tl = bisect.bisect_left(tera, x) bisect.bisect_left(tera, x) tl ans = min(ans, a) min(ans, a) ans temple = [tera[A - 1]] [tera[A - 1]] temple query = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] query B, Q = map(int, input().split()) map(int, input().split()) B sha = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] sha temple = [tera[tl-1], tera[tl]] [tera[tl-1], tera[tl]] temple sr = bisect.bisect_right(sha, x) bisect.bisect_right(sha, x) sr temple = [tera[0]] [tera[0]] temple tx = t - x t - x tx tr = bisect.bisect_right(tera, x) bisect.bisect_right(tera, x) tr A, B, Q = map(int, input().split()) map(int, input().split()) A ans = 10**18 10**18 ans tera = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] tera res = [] [] res Q = map(int, input().split()) map(int, input().split()) Q shrine = [sha[sl-1], sha[sl]] [sha[sl-1], sha[sl]] shrine shrine = [sha[0]] [sha[0]] shrine sx = s - x s - x sx input = sys.stdin.readline sys.stdin.readline input shrine = [sha[B - 1]] [sha[B - 1]] shrine a = max(abs(tx), abs(sx)) max(abs(tx), abs(sx)) a sl = bisect.bisect_left(sha, x) bisect.bisect_left(sha, x) sl a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx)) min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx)) a
import sys
import bisect
input = sys.stdin.readline

A, B, Q = map(int, input().split())
tera = [int(input()) for _ in range(A)]
sha = [int(input()) for _ in range(B)]
query = [int(input()) for _ in range(Q)]
res = []

for x in query:
    tl = bisect.bisect_left(tera, x)
    tr = bisect.bisect_right(tera, x)
    sl = bisect.bisect_left(sha, x)
    sr = bisect.bisect_right(sha, x)

    if tl == 0:
        temple = [tera[0]]
    elif tr == A:
        temple = [tera[A - 1]]
    else:
        temple = [tera[tl-1], tera[tl]]

    if sl == 0:
        shrine = [sha[0]]
    elif sr == B:
        shrine = [sha[B - 1]]
    else:
        shrine = [sha[sl-1], sha[sl]]

    ans = 10**18
    for t in temple:
        for s in shrine:
            tx = t - x
            sx = s - x
            if tx * sx >= 0:
                a = max(abs(tx), abs(sx))
            else:
                a = min(2 * abs(tx) + abs(sx), 2 * abs(sx) + abs(tx))
            ans = min(ans, a)
    res.append(ans)

print(*res, sep="\n")
