import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B, Q = MAP()
s = [INT() for _ in range(A)]
t = [INT() for _ in range(B)]

for _ in range(Q):
	x = INT()
	idx_s = bisect(s, x)
	idx_t = bisect(t, x)

	S = []
	T = []
	if 0 < idx_s:
		S.append(s[idx_s-1])
	if idx_s < A:
		S.append(s[idx_s])

	if 0 < idx_t:
		T.append(t[idx_t-1])
	if idx_t < B:
		T.append(t[idx_t])

	ans = INF
	for shrine, temple in product(S, T):
		if min(shrine, temple) <= x <= max(shrine, temple):
			tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple))
		else:
			tmp = max(abs(x-shrine), abs(x-temple))
		ans = min(ans, tmp)

	print(ans)
 import sys, re sys re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left, insort, insort_left from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) LIST def TUPLE(): return tuple(map(int, input().split())) TUPLE MAP() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) MAP() MAP def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP n n sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = float('inf') INF float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 from decimal import * A, B, Q = MAP() A MAP() MAP B Q INT() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) INT() INT s = [INT() for _ in range(A)] s [INT() for _ in range(A)] INT() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) INT() INT t = [INT() for _ in range(B)] t [INT() for _ in range(B)] for _ in range(Q):
	x = INT()
	idx_s = bisect(s, x)
	idx_t = bisect(t, x)

	S = []
	T = []
	if 0 < idx_s:
		S.append(s[idx_s-1])
	if idx_s < A:
		S.append(s[idx_s])

	if 0 < idx_t:
		T.append(t[idx_t-1])
	if idx_t < B:
		T.append(t[idx_t])

	ans = INF
	for shrine, temple in product(S, T):
		if min(shrine, temple) <= x <= max(shrine, temple):
			tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple))
		else:
			tmp = max(abs(x-shrine), abs(x-temple))
		ans = min(ans, tmp)

	print(ans) _ range(Q) range Q x = INT() x INT() INT idx_s = bisect(s, x) idx_s bisect(s, x) bisect s x idx_t = bisect(t, x) idx_t bisect(t, x) bisect t x S = [] S [] T = [] T [] if 0 < idx_s:
		S.append(s[idx_s-1])
	 0 < idx_s 0 idx_s S.append(s[idx_s-1]) S.append S append s[idx_s-1] s idx_s-1 idx_s 1 if idx_s < A:
		S.append(s[idx_s])

	 idx_s < A idx_s A S.append(s[idx_s]) S.append S append s[idx_s] s idx_s if 0 < idx_t:
		T.append(t[idx_t-1])
	 0 < idx_t 0 idx_t T.append(t[idx_t-1]) T.append T append t[idx_t-1] t idx_t-1 idx_t 1 if idx_t < B:
		T.append(t[idx_t])

	 idx_t < B idx_t B T.append(t[idx_t]) T.append T append t[idx_t] t idx_t ans = INF ans INF for shrine, temple in product(S, T):
		if min(shrine, temple) <= x <= max(shrine, temple):
			tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple))
		else:
			tmp = max(abs(x-shrine), abs(x-temple))
		ans = min(ans, tmp)

	 shrine temple product(S, T) product S T if min(shrine, temple) <= x <= max(shrine, temple):
			tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple))
		else:
			tmp = max(abs(x-shrine), abs(x-temple))
		 min(shrine, temple) <= x <= max(shrine, temple) min(shrine, temple) <= x min(shrine, temple) min shrine temple x max(shrine, temple) max shrine temple tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple)) tmp abs(shrine-temple) + min(abs(x-shrine), abs(x-temple)) abs(shrine-temple) abs shrine-temple shrine temple min(abs(x-shrine), abs(x-temple)) min abs(x-shrine) abs x-shrine x shrine abs(x-temple) abs x-temple x temple tmp = max(abs(x-shrine), abs(x-temple)) tmp max(abs(x-shrine), abs(x-temple)) max abs(x-shrine) abs x-shrine x shrine abs(x-temple) abs x-temple x temple ans = min(ans, tmp) ans min(ans, tmp) min ans tmp print(ans) print ans S = [] [] S def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST s = [INT() for _ in range(A)] [INT() for _ in range(A)] s def ZIP(n): return zip(*(MAP() for _ in range(n))) def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP T = [] [] T x = INT() INT() x A, B, Q = MAP() MAP() A def INT(): return int(input()) def INT(): return int(input()) INT def TUPLE(): return tuple(map(int, input().split())) def TUPLE(): return tuple(map(int, input().split())) TUPLE def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple)) abs(shrine-temple) + min(abs(x-shrine), abs(x-temple)) tmp tmp = max(abs(x-shrine), abs(x-temple)) max(abs(x-shrine), abs(x-temple)) tmp Q = MAP() MAP() Q def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP idx_s = bisect(s, x) bisect(s, x) idx_s mod = 10 ** 9 + 7 10 ** 9 + 7 mod ans = min(ans, tmp) min(ans, tmp) ans INF = float('inf') float('inf') INF B, Q = MAP() MAP() B ans = INF INF ans idx_t = bisect(t, x) bisect(t, x) idx_t t = [INT() for _ in range(B)] [INT() for _ in range(B)] t
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B, Q = MAP()
s = [INT() for _ in range(A)]
t = [INT() for _ in range(B)]

for _ in range(Q):
	x = INT()
	idx_s = bisect(s, x)
	idx_t = bisect(t, x)

	S = []
	T = []
	if 0 < idx_s:
		S.append(s[idx_s-1])
	if idx_s < A:
		S.append(s[idx_s])

	if 0 < idx_t:
		T.append(t[idx_t-1])
	if idx_t < B:
		T.append(t[idx_t])

	ans = INF
	for shrine, temple in product(S, T):
		if min(shrine, temple) <= x <= max(shrine, temple):
			tmp = abs(shrine-temple) + min(abs(x-shrine), abs(x-temple))
		else:
			tmp = max(abs(x-shrine), abs(x-temple))
		ans = min(ans, tmp)

	print(ans)

