import sys
input = sys.stdin.readline

a, b, q = [int(x) for x in input().split()]
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
ans = []

import bisect
ans = []
for _ in range(q):
    x = int(input())
    idx_s = bisect.bisect_left(s, x)
    idx_t = bisect.bisect_right(t, x)
    s_ = []
    t_ = []
    if idx_s < a:
        s_.append(s[idx_s])
    if idx_t < b:
        t_.append(t[idx_t])
    if idx_s - 1 >= 0:
        s_.append(s[idx_s - 1])
    if idx_t - 1 >= 0:
        t_.append(t[idx_t - 1])
    res = float("inf")
    for i in s_:
        for j in t_:
            if (i >= x and j >= x) or (i <= x and j <= x):
                res = min(res, max(abs(i - x), abs(j - x)))
            else:
                res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j))
    ans.append(res)
for i in ans:
    print(i)
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x a, b, q = [int(x) for x in input().split()] a [int(x) for x in 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 s = [int(input()) for _ in range(a)] s [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 t = [int(input()) for _ in range(b)] t [int(input()) for _ in range(b)] ans = [] ans [] import bisect bisect ans = [] ans [] for _ in range(q):
    x = int(input())
    idx_s = bisect.bisect_left(s, x)
    idx_t = bisect.bisect_right(t, x)
    s_ = []
    t_ = []
    if idx_s < a:
        s_.append(s[idx_s])
    if idx_t < b:
        t_.append(t[idx_t])
    if idx_s - 1 >= 0:
        s_.append(s[idx_s - 1])
    if idx_t - 1 >= 0:
        t_.append(t[idx_t - 1])
    res = float("inf")
    for i in s_:
        for j in t_:
            if (i >= x and j >= x) or (i <= x and j <= x):
                res = min(res, max(abs(i - x), abs(j - x)))
            else:
                res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j))
    ans.append(res) _ range(q) range q x = int(input()) x int(input()) int input() input idx_s = bisect.bisect_left(s, x) idx_s bisect.bisect_left(s, x) bisect.bisect_left bisect bisect_left s x idx_t = bisect.bisect_right(t, x) idx_t bisect.bisect_right(t, x) bisect.bisect_right bisect bisect_right t x s_ = [] s_ [] t_ = [] t_ [] if idx_s < a:
        s_.append(s[idx_s])
     idx_s < a idx_s a s_.append(s[idx_s]) s_.append s_ append s[idx_s] s idx_s if idx_t < b:
        t_.append(t[idx_t])
     idx_t < b idx_t b t_.append(t[idx_t]) t_.append t_ append t[idx_t] t idx_t if idx_s - 1 >= 0:
        s_.append(s[idx_s - 1])
     idx_s - 1 >= 0 idx_s - 1 idx_s 1 0 s_.append(s[idx_s - 1]) s_.append s_ append s[idx_s - 1] s idx_s - 1 idx_s 1 if idx_t - 1 >= 0:
        t_.append(t[idx_t - 1])
     idx_t - 1 >= 0 idx_t - 1 idx_t 1 0 t_.append(t[idx_t - 1]) t_.append t_ append t[idx_t - 1] t idx_t - 1 idx_t 1 res = float("inf") res float("inf") float "inf" for i in s_:
        for j in t_:
            if (i >= x and j >= x) or (i <= x and j <= x):
                res = min(res, max(abs(i - x), abs(j - x)))
            else:
                res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j))
     i s_ for j in t_:
            if (i >= x and j >= x) or (i <= x and j <= x):
                res = min(res, max(abs(i - x), abs(j - x)))
            else:
                res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j))
     j t_ if (i >= x and j >= x) or (i <= x and j <= x):
                res = min(res, max(abs(i - x), abs(j - x)))
            else:
                res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j))
     (i >= x and j >= x) or (i <= x and j <= x) i >= x and j >= x i >= x i x j >= x j x i <= x and j <= x i <= x i x j <= x j x res = min(res, max(abs(i - x), abs(j - x))) res min(res, max(abs(i - x), abs(j - x))) min res max(abs(i - x), abs(j - x)) max abs(i - x) abs i - x i x abs(j - x) abs j - x j x res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j)) res min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j)) min res abs(i - x) + abs(i - j) abs(i - x) abs i - x i x abs(i - j) abs i - j i j abs(j - x) + abs(i - j) abs(j - x) abs j - x j x abs(i - j) abs i - j i j ans.append(res) ans.append ans append res for i in ans:
    print(i) i ans print(i) print i a, b, q = [int(x) for x in input().split()] [int(x) for x in input().split()] a s_ = [] [] s_ res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j)) min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j)) res ans = [] [] ans x = int(input()) int(input()) x input = sys.stdin.readline sys.stdin.readline input idx_s = bisect.bisect_left(s, x) bisect.bisect_left(s, x) idx_s q = [int(x) for x in input().split()] [int(x) for x in input().split()] q b, q = [int(x) for x in input().split()] [int(x) for x in input().split()] b s = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] s t = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] t t_ = [] [] t_ ans = [] [] ans res = min(res, max(abs(i - x), abs(j - x))) min(res, max(abs(i - x), abs(j - x))) res idx_t = bisect.bisect_right(t, x) bisect.bisect_right(t, x) idx_t res = float("inf") float("inf") res
import sys
input = sys.stdin.readline

a, b, q = [int(x) for x in input().split()]
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
ans = []

import bisect
ans = []
for _ in range(q):
    x = int(input())
    idx_s = bisect.bisect_left(s, x)
    idx_t = bisect.bisect_right(t, x)
    s_ = []
    t_ = []
    if idx_s < a:
        s_.append(s[idx_s])
    if idx_t < b:
        t_.append(t[idx_t])
    if idx_s - 1 >= 0:
        s_.append(s[idx_s - 1])
    if idx_t - 1 >= 0:
        t_.append(t[idx_t - 1])
    res = float("inf")
    for i in s_:
        for j in t_:
            if (i >= x and j >= x) or (i <= x and j <= x):
                res = min(res, max(abs(i - x), abs(j - x)))
            else:
                res = min(res, abs(i - x) + abs(i - j), abs(j - x) + abs(i - j))
    ans.append(res)
for i in ans:
    print(i)

