from bisect import bisect_left
import sys
def main():
    input = sys.stdin.readline
    A, B, Q = map(int, input().split())
    S = [int(input()) for _ in range(A)]
    T = [int(input()) for _ in range(B)]
    X = [int(input()) for _ in range(Q)]
    INF = 10 ** 11
    S = [-INF] + S + [INF]
    T = [-INF] + T + [INF]
    for x in X:
        i = bisect_left(S, x)
        ls = x - S[i - 1]
        rs = S[i] - x
        j = bisect_left(T, x)
        lt = x - T[j - 1]
        rt = T[j] - x
        print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt))

if __name__ == '__main__':
    main() from bisect import bisect_left import sys sys def main():
    input = sys.stdin.readline
    A, B, Q = map(int, input().split())
    S = [int(input()) for _ in range(A)]
    T = [int(input()) for _ in range(B)]
    X = [int(input()) for _ in range(Q)]
    INF = 10 ** 11
    S = [-INF] + S + [INF]
    T = [-INF] + T + [INF]
    for x in X:
        i = bisect_left(S, x)
        ls = x - S[i - 1]
        rs = S[i] - x
        j = bisect_left(T, x)
        lt = x - T[j - 1]
        rt = T[j] - x
        print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt)) main 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 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)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input X = [int(input()) for _ in range(Q)] X [int(input()) for _ in range(Q)] INF = 10 ** 11 INF 10 ** 11 10 11 S = [-INF] + S + [INF] S [-INF] + S + [INF] [-INF] + S [-INF] -INF INF S [INF] INF T = [-INF] + T + [INF] T [-INF] + T + [INF] [-INF] + T [-INF] -INF INF T [INF] INF for x in X:
        i = bisect_left(S, x)
        ls = x - S[i - 1]
        rs = S[i] - x
        j = bisect_left(T, x)
        lt = x - T[j - 1]
        rt = T[j] - x
        print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt)) x X i = bisect_left(S, x) i bisect_left(S, x) bisect_left S x ls = x - S[i - 1] ls x - S[i - 1] x S[i - 1] S i - 1 i 1 rs = S[i] - x rs S[i] - x S[i] S i x j = bisect_left(T, x) j bisect_left(T, x) bisect_left T x lt = x - T[j - 1] lt x - T[j - 1] x T[j - 1] T j - 1 j 1 rt = T[j] - x rt T[j] - x T[j] T j x print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt)) print min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt) min max(ls, lt) max ls lt max(rs, rt) max rs rt 2 * ls + rt 2 * ls 2 ls rt ls + 2 * rt ls 2 * rt 2 rt 2 * rs + lt 2 * rs 2 rs lt rs + 2 * lt rs 2 * lt 2 lt if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    input = sys.stdin.readline
    A, B, Q = map(int, input().split())
    S = [int(input()) for _ in range(A)]
    T = [int(input()) for _ in range(B)]
    X = [int(input()) for _ in range(Q)]
    INF = 10 ** 11
    S = [-INF] + S + [INF]
    T = [-INF] + T + [INF]
    for x in X:
        i = bisect_left(S, x)
        ls = x - S[i - 1]
        rs = S[i] - x
        j = bisect_left(T, x)
        lt = x - T[j - 1]
        rt = T[j] - x
        print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt)) def main():
    input = sys.stdin.readline
    A, B, Q = map(int, input().split())
    S = [int(input()) for _ in range(A)]
    T = [int(input()) for _ in range(B)]
    X = [int(input()) for _ in range(Q)]
    INF = 10 ** 11
    S = [-INF] + S + [INF]
    T = [-INF] + T + [INF]
    for x in X:
        i = bisect_left(S, x)
        ls = x - S[i - 1]
        rs = S[i] - x
        j = bisect_left(T, x)
        lt = x - T[j - 1]
        rt = T[j] - x
        print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt)) main
from bisect import bisect_left
import sys
def main():
    input = sys.stdin.readline
    A, B, Q = map(int, input().split())
    S = [int(input()) for _ in range(A)]
    T = [int(input()) for _ in range(B)]
    X = [int(input()) for _ in range(Q)]
    INF = 10 ** 11
    S = [-INF] + S + [INF]
    T = [-INF] + T + [INF]
    for x in X:
        i = bisect_left(S, x)
        ls = x - S[i - 1]
        rs = S[i] - x
        j = bisect_left(T, x)
        lt = x - T[j - 1]
        rt = T[j] - x
        print(min(max(ls, lt), max(rs, rt), 2 * ls + rt, ls + 2 * rt, 2 * rs + lt, rs + 2 * lt))

if __name__ == '__main__':
    main()
