from bisect import bisect_left as bl

def I(a): return [-1<<50] + [int(eval(input())) for i in range(a)] + [1<<50]

A, B, Q = list(map(int, input().split()))

S, T = I(A), I(B)



for _ in range(Q):

    x = int(eval(input()))

    k, l = bl(S, x), bl(T, x)

    a, b, c, d = x-S[k-1], x-T[l-1], S[k]-x, T[l]-x

    print((min(max(a, b), max(c, d), 2*a+d, 2*d+a, 2*b+c, 2*c+b)))
import sys

from bisect import bisect_left as bl

def I(a): return [-1<<50] + [int(sys.stdin.readline()) for i in range(a)] + [1<<50]

A, B, Q = list(map(int, input().split()))

S, T = I(A), I(B)



for _ in range(Q):

    x = int(eval(input()))

    k, l = bl(S, x), bl(T, x)

    a, b, c, d = x-S[k-1], x-T[l-1], S[k]-x, T[l]-x

    print((min(max(a, b), max(c, d), 2*a+d, 2*d+a, 2*b+c, 2*c+b)))
from bisect import bisect_left as bl


def I(a):
    return [-1 << 50] + [int(eval(input())) for i in range(a)] + [1 << 50]


A, B, Q = list(map(int, input().split()))
S, T = I(A), I(B)
for _ in range(Q):
    x = int(eval(input()))
    k, l = bl(S, x), bl(T, x)
    a, b, c, d = x - S[k - 1], x - T[l - 1], S[k] - x, T[l] - x
    print((min(max(a, b), max(c, d), 2 * a + d, 2 * d + a, 2 * b + c, 2 * c + b)))

import sys
from bisect import bisect_left as bl


def I(a):
    return [-1 << 50] + [int(sys.stdin.readline()) for i in range(a)] + [1 << 50]


A, B, Q = list(map(int, input().split()))
S, T = I(A), I(B)
for _ in range(Q):
    x = int(eval(input()))
    k, l = bl(S, x), bl(T, x)
    a, b, c, d = x - S[k - 1], x - T[l - 1], S[k] - x, T[l] - x
    print((min(max(a, b), max(c, d), 2 * a + d, 2 * d + a, 2 * b + c, 2 * c + b)))

+import sys -    return [-1 << 50] + [int(eval(input())) for i in range(a)] + [1 << 50] +    return [-1 << 50] + [int(sys.stdin.readline()) for i in range(a)] + [1 << 50]