import sys

def input(): return sys.stdin.readline().strip()

def mapint(): return list(map(int, input().split()))

sys.setrecursionlimit(10**9)



A, B, Q = mapint()

Ss = [-10**20]+[int(eval(input())) for _ in range(A)]+[10**20]

Ts = [-10**20]+[int(eval(input())) for _ in range(B)]+[10**20]

Ss.sort()

Ts.sort()

from bisect import bisect_left



for _ in range(Q):

    x = int(eval(input()))

    xs = bisect_left(Ss, x)

    xt = bisect_left(Ts, x)



    rr = max(Ss[xs]-x, Ts[xt]-x)

    ll = max(x-Ss[xs-1], x-Ts[xt-1])

    lr = min(abs(x-Ss[xs-1])*2+abs(x-Ts[xt]), abs(x-Ts[xt-1])*2+abs(x-Ss[xs]))

    rl = min(abs(x-Ss[xs-1])+abs(x-Ts[xt])*2, abs(x-Ts[xt-1])+abs(x-Ss[xs])*2)

    print((min(rr, ll, rl, lr)))
import sys

def input(): return sys.stdin.readline().strip()

def mapint(): return list(map(int, input().split()))

sys.setrecursionlimit(10**9)



A, B, Q = mapint()

Ss = [-10**18]+[int(eval(input())) for _ in range(A)]+[10**18]

Ts = [-10**18]+[int(eval(input())) for _ in range(B)]+[10**18]

from bisect import bisect_left



for q in range(Q):

    x = int(eval(input()))

    ls = Ss[bisect_left(Ss, x)-1]

    lt = Ts[bisect_left(Ts, x)-1]

    rs = Ss[bisect_left(Ss, x)]

    rt = Ts[bisect_left(Ts, x)]

    print((min((rs-lt)+min(rs-x, x-lt), (rt-ls)+min(rt-x, x-ls), max(x-ls, x-lt), max(rs-x, rt-x))))
import sys


def input():
    return sys.stdin.readline().strip()


def mapint():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
A, B, Q = mapint()
Ss = [-(10**20)] + [int(eval(input())) for _ in range(A)] + [10**20]
Ts = [-(10**20)] + [int(eval(input())) for _ in range(B)] + [10**20]
Ss.sort()
Ts.sort()
from bisect import bisect_left

for _ in range(Q):
    x = int(eval(input()))
    xs = bisect_left(Ss, x)
    xt = bisect_left(Ts, x)
    rr = max(Ss[xs] - x, Ts[xt] - x)
    ll = max(x - Ss[xs - 1], x - Ts[xt - 1])
    lr = min(
        abs(x - Ss[xs - 1]) * 2 + abs(x - Ts[xt]),
        abs(x - Ts[xt - 1]) * 2 + abs(x - Ss[xs]),
    )
    rl = min(
        abs(x - Ss[xs - 1]) + abs(x - Ts[xt]) * 2,
        abs(x - Ts[xt - 1]) + abs(x - Ss[xs]) * 2,
    )
    print((min(rr, ll, rl, lr)))

import sys


def input():
    return sys.stdin.readline().strip()


def mapint():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
A, B, Q = mapint()
Ss = [-(10**18)] + [int(eval(input())) for _ in range(A)] + [10**18]
Ts = [-(10**18)] + [int(eval(input())) for _ in range(B)] + [10**18]
from bisect import bisect_left

for q in range(Q):
    x = int(eval(input()))
    ls = Ss[bisect_left(Ss, x) - 1]
    lt = Ts[bisect_left(Ts, x) - 1]
    rs = Ss[bisect_left(Ss, x)]
    rt = Ts[bisect_left(Ts, x)]
    print(
        (
            min(
                (rs - lt) + min(rs - x, x - lt),
                (rt - ls) + min(rt - x, x - ls),
                max(x - ls, x - lt),
                max(rs - x, rt - x),
            )
        )
    )

-Ss = [-(10**20)] + [int(eval(input())) for _ in range(A)] + [10**20] -Ts = [-(10**20)] + [int(eval(input())) for _ in range(B)] + [10**20] -Ss.sort() -Ts.sort() +Ss = [-(10**18)] + [int(eval(input())) for _ in range(A)] + [10**18] +Ts = [-(10**18)] + [int(eval(input())) for _ in range(B)] + [10**18] -for _ in range(Q): +for q in range(Q): -    xs = bisect_left(Ss, x) -    xt = bisect_left(Ts, x) -    rr = max(Ss[xs] - x, Ts[xt] - x) -    ll = max(x - Ss[xs - 1], x - Ts[xt - 1]) -    lr = min( -        abs(x - Ss[xs - 1]) * 2 + abs(x - Ts[xt]), -        abs(x - Ts[xt - 1]) * 2 + abs(x - Ss[xs]), +    ls = Ss[bisect_left(Ss, x) - 1] +    lt = Ts[bisect_left(Ts, x) - 1] +    rs = Ss[bisect_left(Ss, x)] +    rt = Ts[bisect_left(Ts, x)] +    print( +        ( +            min( +                (rs - lt) + min(rs - x, x - lt), +                (rt - ls) + min(rt - x, x - ls), +                max(x - ls, x - lt), +                max(rs - x, rt - x), +            ) +        ) -    rl = min( -        abs(x - Ss[xs - 1]) + abs(x - Ts[xt]) * 2, -        abs(x - Ts[xt - 1]) + abs(x - Ss[xs]) * 2, -    ) -    print((min(rr, ll, rl, lr)))