from bisect import bisect_left
import sys
input = sys.stdin.readline

a, b, q = map(int, input().split())
INF = 10**12
s = [-INF] + [int(input()) for i in range(a)] + [INF]
t = [-INF] + [int(input()) for i in range(b)] + [INF]


for _ in range(q):
    x = int(input())
    k = bisect_left(s, x)
    l = bisect_left(t, x)
    sm = x - s[k - 1]
    sM = s[k] - x
    tm = x - t[l - 1]
    tM = t[l] - x
    ans = min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM))
    print(ans) from bisect import bisect_left 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 INF = 10**12 INF 10**12 10 12 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 s = [-INF] + [int(input()) for i in range(a)] + [INF] s [-INF] + [int(input()) for i in range(a)] + [INF] [-INF] + [int(input()) for i in range(a)] [-INF] -INF INF [int(input()) for i in range(a)] [INF] 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 t = [-INF] + [int(input()) for i in range(b)] + [INF] t [-INF] + [int(input()) for i in range(b)] + [INF] [-INF] + [int(input()) for i in range(b)] [-INF] -INF INF [int(input()) for i in range(b)] [INF] INF for _ in range(q):
    x = int(input())
    k = bisect_left(s, x)
    l = bisect_left(t, x)
    sm = x - s[k - 1]
    sM = s[k] - x
    tm = x - t[l - 1]
    tM = t[l] - x
    ans = min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM))
    print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input k = bisect_left(s, x) k bisect_left(s, x) bisect_left s x l = bisect_left(t, x) l bisect_left(t, x) bisect_left t x sm = x - s[k - 1] sm x - s[k - 1] x s[k - 1] s k - 1 k 1 sM = s[k] - x sM s[k] - x s[k] s k x tm = x - t[l - 1] tm x - t[l - 1] x t[l - 1] t l - 1 l 1 tM = t[l] - x tM t[l] - x t[l] t l x ans = min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM)) ans min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM)) min 2 * sm + tM 2 * sm 2 sm tM 2 * sM + tm 2 * sM 2 sM tm 2 * tm + sM 2 * tm 2 tm sM 2 * tM + sm 2 * tM 2 tM sm max(sm, tm) max sm tm max(sM, tM) max sM tM print(ans) print ans k = bisect_left(s, x) bisect_left(s, x) k tm = x - t[l - 1] x - t[l - 1] tm l = bisect_left(t, x) bisect_left(t, x) l s = [-INF] + [int(input()) for i in range(a)] + [INF] [-INF] + [int(input()) for i in range(a)] + [INF] s x = int(input()) int(input()) x input = sys.stdin.readline sys.stdin.readline input sM = s[k] - x s[k] - x sM a, b, q = map(int, input().split()) map(int, input().split()) a b, q = map(int, input().split()) map(int, input().split()) b t = [-INF] + [int(input()) for i in range(b)] + [INF] [-INF] + [int(input()) for i in range(b)] + [INF] t INF = 10**12 10**12 INF tM = t[l] - x t[l] - x tM sm = x - s[k - 1] x - s[k - 1] sm ans = min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM)) min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM)) ans q = map(int, input().split()) map(int, input().split()) q
from bisect import bisect_left
import sys
input = sys.stdin.readline

a, b, q = map(int, input().split())
INF = 10**12
s = [-INF] + [int(input()) for i in range(a)] + [INF]
t = [-INF] + [int(input()) for i in range(b)] + [INF]


for _ in range(q):
    x = int(input())
    k = bisect_left(s, x)
    l = bisect_left(t, x)
    sm = x - s[k - 1]
    sM = s[k] - x
    tm = x - t[l - 1]
    tM = t[l] - x
    ans = min(2 * sm + tM, 2 * sM + tm, 2 * tm + sM, 2 * tM + sm, max(sm, tm), max(sM, tM))
    print(ans)
