def binary_search(n, arr, target, lower=True):
    flg = True
    cnt = 0
    while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
    if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d

A, B, Q = map(int, input().split())
S = [-int(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)]
T = [-int(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)]
for i in range(Q):
    x = int(input())
    sl = binary_search(A+2, S, x)
    tl = binary_search(B+2, T, x)
    ll = max(x - S[sl], x - T[tl])
    lr = min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl])
    rl = min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl])
    rr = max(S[sl+1] - x, T[tl+1] - x)
    print(min(ll, lr, rl, rr)) def binary_search(n, arr, target, lower=True):
    flg = True
    cnt = 0
    while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
    if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d binary_search flg = True flg True cnt = 0 cnt 0 while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
     flg if n >> cnt:
            cnt += 1
        else:
            flg = False
     n >> cnt n cnt cnt += 1 cnt 1 flg = False flg False if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d lower if target < arr[0]:
            return -1
         target < arr[0] target arr[0] arr 0 return -1 -1 if target >= arr[n-1]:
            return n
         target >= arr[n-1] target arr[n-1] arr n-1 n 1 return n n l, r = 0, n l 0 r n d = (l + r) // 2 d (l + r) // 2 l + r l r 2 for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
         i range(cnt+1) range cnt+1 cnt 1 if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
         arr[d] <= target arr[d] arr d target l = d l d d = (l + r) // 2 d (l + r) // 2 l + r l r 2 r = d r d d = (l + r) // 2 d (l + r) // 2 l + r l r 2 return d d n n arr arr target target lower=True lower True 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(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)] S [-int(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)] [-int(1e13)] + [int(input()) for _ in range(A)] [-int(1e13)] -int(1e13) int(1e13) int 1e13 [int(input()) for _ in range(A)] [int(1e13)] int(1e13) int 1e13 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(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)] T [-int(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)] [-int(1e13)] + [int(input()) for _ in range(B)] [-int(1e13)] -int(1e13) int(1e13) int 1e13 [int(input()) for _ in range(B)] [int(1e13)] int(1e13) int 1e13 for i in range(Q):
    x = int(input())
    sl = binary_search(A+2, S, x)
    tl = binary_search(B+2, T, x)
    ll = max(x - S[sl], x - T[tl])
    lr = min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl])
    rl = min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl])
    rr = max(S[sl+1] - x, T[tl+1] - x)
    print(min(ll, lr, rl, rr)) i range(Q) range Q x = int(input()) x int(input()) int input() input sl = binary_search(A+2, S, x) sl binary_search(A+2, S, x) binary_search A+2 A 2 S x tl = binary_search(B+2, T, x) tl binary_search(B+2, T, x) binary_search B+2 B 2 T x ll = max(x - S[sl], x - T[tl]) ll max(x - S[sl], x - T[tl]) max x - S[sl] x S[sl] S sl x - T[tl] x T[tl] T tl lr = min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl]) lr min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl]) min T[tl+1] - x + 2 * (x - S[sl]) T[tl+1] - x T[tl+1] T tl+1 tl 1 x 2 * (x - S[sl]) 2 x - S[sl] x S[sl] S sl 2 * (T[tl+1] - x) + x - S[sl] 2 * (T[tl+1] - x) + x 2 * (T[tl+1] - x) 2 T[tl+1] - x T[tl+1] T tl+1 tl 1 x x S[sl] S sl rl = min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl]) rl min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl]) min S[sl+1] - x + 2 * (x - T[tl]) S[sl+1] - x S[sl+1] S sl+1 sl 1 x 2 * (x - T[tl]) 2 x - T[tl] x T[tl] T tl 2 * (S[sl+1] - x) + x - T[tl] 2 * (S[sl+1] - x) + x 2 * (S[sl+1] - x) 2 S[sl+1] - x S[sl+1] S sl+1 sl 1 x x T[tl] T tl rr = max(S[sl+1] - x, T[tl+1] - x) rr max(S[sl+1] - x, T[tl+1] - x) max S[sl+1] - x S[sl+1] S sl+1 sl 1 x T[tl+1] - x T[tl+1] T tl+1 tl 1 x print(min(ll, lr, rl, rr)) print min(ll, lr, rl, rr) min ll lr rl rr Q = map(int, input().split()) map(int, input().split()) Q rl = min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl]) min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl]) rl rr = max(S[sl+1] - x, T[tl+1] - x) max(S[sl+1] - x, T[tl+1] - x) rr T = [-int(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)] [-int(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)] T A, B, Q = map(int, input().split()) map(int, input().split()) A ll = max(x - S[sl], x - T[tl]) max(x - S[sl], x - T[tl]) ll S = [-int(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)] [-int(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)] S sl = binary_search(A+2, S, x) binary_search(A+2, S, x) sl tl = binary_search(B+2, T, x) binary_search(B+2, T, x) tl lr = min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl]) min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl]) lr B, Q = map(int, input().split()) map(int, input().split()) B x = int(input()) int(input()) x def binary_search(n, arr, target, lower=True):
    flg = True
    cnt = 0
    while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
    if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d def binary_search(n, arr, target, lower=True):
    flg = True
    cnt = 0
    while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
    if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d binary_search
def binary_search(n, arr, target, lower=True):
    flg = True
    cnt = 0
    while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
    if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d

A, B, Q = map(int, input().split())
S = [-int(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)]
T = [-int(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)]
for i in range(Q):
    x = int(input())
    sl = binary_search(A+2, S, x)
    tl = binary_search(B+2, T, x)
    ll = max(x - S[sl], x - T[tl])
    lr = min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl])
    rl = min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl])
    rr = max(S[sl+1] - x, T[tl+1] - x)
    print(min(ll, lr, rl, rr))