"""
D - Lazy Faith
"""
# 解説を参考に作成（bisect）
import bisect


def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t)))


if __name__ == '__main__':
    solve() """
D - Lazy Faith
""" import bisect bisect def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t))) solve A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q int(input()) for i in range(A) for i in range(A) i range(A) range A for i in range(A) int(input()) int input() input si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')] si [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')] [-float('inf')] + [int(input()) for i in range(A)] [-float('inf')] -float('inf') float('inf') float 'inf' [int(input()) for i in range(A)] [float('inf')] float('inf') float 'inf' int(input()) for i in range(B) for i in range(B) i range(B) range B for i in range(B) int(input()) int input() input ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')] ti [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')] [-float('inf')] + [int(input()) for i in range(B)] [-float('inf')] -float('inf') float('inf') float 'inf' [int(input()) for i in range(B)] [float('inf')] float('inf') float 'inf' int(input()) for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) int(input()) int input() input xi = [int(input()) for i in range(Q)] xi [int(input()) for i in range(Q)] for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t))) x xi txi = bisect.bisect_left(ti, x) txi bisect.bisect_left(ti, x) bisect.bisect_left bisect bisect_left ti x left_t = ti[txi - 1] left_t ti[txi - 1] ti txi - 1 txi 1 right_t = ti[txi] right_t ti[txi] ti txi sxi = bisect.bisect_left(si, x) sxi bisect.bisect_left(si, x) bisect.bisect_left bisect bisect_left si x left_s = si[sxi - 1] left_s si[sxi - 1] si sxi - 1 sxi 1 right_s = si[sxi] right_s si[sxi] si sxi print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t))) print min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t)) min abs(x - min(left_t, left_s)) abs x - min(left_t, left_s) x min(left_t, left_s) min left_t left_s abs(x - max(right_t, right_s)) abs x - max(right_t, right_s) x max(right_t, right_s) max right_t right_s abs(x - right_t) + abs(right_t - left_s) abs(x - right_t) abs x - right_t x right_t abs(right_t - left_s) abs right_t - left_s right_t left_s abs(x - left_t) + abs(left_t - right_s) abs(x - left_t) abs x - left_t x left_t abs(left_t - right_s) abs left_t - right_s left_t right_s abs(x - right_s) + abs(right_s - left_t) abs(x - right_s) abs x - right_s x right_s abs(right_s - left_t) abs right_s - left_t right_s left_t abs(x - left_s) + abs(left_s - right_t) abs(x - left_s) abs x - left_s x left_s abs(left_s - right_t) abs left_s - right_t left_s right_t if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t))) def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t))) solve
"""
D - Lazy Faith
"""
# 解説を参考に作成（bisect）
import bisect


def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t)))


if __name__ == '__main__':
    solve()
