import bisect
import sys
input = sys.stdin.readline

A, B, Q = map(int, input().split())
Shrine = [int(input()) for _ in range(A)]
Temple = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
Shrine = [-100000000000] + Shrine + [100000000000]
Temple = [-100000000000] + Temple + [100000000000]

for x in X:
    nums = bisect.bisect_left(Shrine, x)
    tems = bisect.bisect_left(Temple, x)
    ans1 = max(abs(Shrine[nums]-x), abs(Temple[tems]-x))
    ans2 = max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1]))
    ans3 = abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1])
    ans4 = abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1])
    ans5 = abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x)
    ans6 = abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x)

    print(min(ans1, ans2, ans3, ans4, ans5, ans6)) import bisect bisect import sys sys 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 Shrine = [int(input()) for _ in range(A)] Shrine [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 Temple = [int(input()) for _ in range(B)] Temple [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)] Shrine = [-100000000000] + Shrine + [100000000000] Shrine [-100000000000] + Shrine + [100000000000] [-100000000000] + Shrine [-100000000000] -100000000000 Shrine [100000000000] 100000000000 Temple = [-100000000000] + Temple + [100000000000] Temple [-100000000000] + Temple + [100000000000] [-100000000000] + Temple [-100000000000] -100000000000 Temple [100000000000] 100000000000 for x in X:
    nums = bisect.bisect_left(Shrine, x)
    tems = bisect.bisect_left(Temple, x)
    ans1 = max(abs(Shrine[nums]-x), abs(Temple[tems]-x))
    ans2 = max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1]))
    ans3 = abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1])
    ans4 = abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1])
    ans5 = abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x)
    ans6 = abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x)

    print(min(ans1, ans2, ans3, ans4, ans5, ans6)) x X nums = bisect.bisect_left(Shrine, x) nums bisect.bisect_left(Shrine, x) bisect.bisect_left bisect bisect_left Shrine x tems = bisect.bisect_left(Temple, x) tems bisect.bisect_left(Temple, x) bisect.bisect_left bisect bisect_left Temple x ans1 = max(abs(Shrine[nums]-x), abs(Temple[tems]-x)) ans1 max(abs(Shrine[nums]-x), abs(Temple[tems]-x)) max abs(Shrine[nums]-x) abs Shrine[nums]-x Shrine[nums] Shrine nums x abs(Temple[tems]-x) abs Temple[tems]-x Temple[tems] Temple tems x ans2 = max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1])) ans2 max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1])) max abs(x - Shrine[nums-1]) abs x - Shrine[nums-1] x Shrine[nums-1] Shrine nums-1 nums 1 abs(x - Temple[tems-1]) abs x - Temple[tems-1] x Temple[tems-1] Temple tems-1 tems 1 ans3 = abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1]) ans3 abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1]) abs(Shrine[nums]-x) * 2 abs(Shrine[nums]-x) abs Shrine[nums]-x Shrine[nums] Shrine nums x 2 abs(x - Temple[tems-1]) abs x - Temple[tems-1] x Temple[tems-1] Temple tems-1 tems 1 ans4 = abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1]) ans4 abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1]) abs(Temple[tems]-x) * 2 abs(Temple[tems]-x) abs Temple[tems]-x Temple[tems] Temple tems x 2 abs(x - Shrine[nums-1]) abs x - Shrine[nums-1] x Shrine[nums-1] Shrine nums-1 nums 1 ans5 = abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x) ans5 abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x) abs(x - Shrine[nums-1]) * 2 abs(x - Shrine[nums-1]) abs x - Shrine[nums-1] x Shrine[nums-1] Shrine nums-1 nums 1 2 abs(Temple[tems]-x) abs Temple[tems]-x Temple[tems] Temple tems x ans6 = abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x) ans6 abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x) abs(x - Temple[tems-1]) * 2 abs(x - Temple[tems-1]) abs x - Temple[tems-1] x Temple[tems-1] Temple tems-1 tems 1 2 abs(Shrine[nums]-x) abs Shrine[nums]-x Shrine[nums] Shrine nums x print(min(ans1, ans2, ans3, ans4, ans5, ans6)) print min(ans1, ans2, ans3, ans4, ans5, ans6) min ans1 ans2 ans3 ans4 ans5 ans6 Shrine = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] Shrine ans6 = abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x) abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x) ans6 Q = map(int, input().split()) map(int, input().split()) Q ans1 = max(abs(Shrine[nums]-x), abs(Temple[tems]-x)) max(abs(Shrine[nums]-x), abs(Temple[tems]-x)) ans1 nums = bisect.bisect_left(Shrine, x) bisect.bisect_left(Shrine, x) nums Shrine = [-100000000000] + Shrine + [100000000000] [-100000000000] + Shrine + [100000000000] Shrine ans2 = max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1])) max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1])) ans2 X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X Temple = [-100000000000] + Temple + [100000000000] [-100000000000] + Temple + [100000000000] Temple ans4 = abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1]) abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1]) ans4 tems = bisect.bisect_left(Temple, x) bisect.bisect_left(Temple, x) tems B, Q = map(int, input().split()) map(int, input().split()) B A, B, Q = map(int, input().split()) map(int, input().split()) A Temple = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] Temple ans5 = abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x) abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x) ans5 ans3 = abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1]) abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1]) ans3 input = sys.stdin.readline sys.stdin.readline input
import bisect
import sys
input = sys.stdin.readline

A, B, Q = map(int, input().split())
Shrine = [int(input()) for _ in range(A)]
Temple = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
Shrine = [-100000000000] + Shrine + [100000000000]
Temple = [-100000000000] + Temple + [100000000000]

for x in X:
    nums = bisect.bisect_left(Shrine, x)
    tems = bisect.bisect_left(Temple, x)
    ans1 = max(abs(Shrine[nums]-x), abs(Temple[tems]-x))
    ans2 = max(abs(x - Shrine[nums-1]), abs(x - Temple[tems-1]))
    ans3 = abs(Shrine[nums]-x) * 2 + abs(x - Temple[tems-1])
    ans4 = abs(Temple[tems]-x) * 2 + abs(x - Shrine[nums-1])
    ans5 = abs(x - Shrine[nums-1]) * 2 + abs(Temple[tems]-x)
    ans6 = abs(x - Temple[tems-1]) * 2 + abs(Shrine[nums]-x)

    print(min(ans1, ans2, ans3, ans4, ans5, ans6))