# なぜかうまくいかない
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_right, bisect_left

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, Q = MAP()
S = [INT() for i in range(A)]
T = [INT() for i in range(B)]
X = [INT() for i in range(Q)]
S.insert(0, -INF)
S.append(INF)
T.insert(0, -INF)
T.append(INF)

for x in X:
    s = bisect(S, x)
    t = bisect(T, x)
    # print(s, t)
    # a = min(x - S[s-1], S[s] - x)
    # b = min(x - T[t-1], T[t] - x)
    res = INF
    for a in [S[s-1], S[s]]:
        for b in [T[t-1], T[t]]:
            res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a)))
    print(res)    
    
 import sys, re, os sys re os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from fractions import gcd from bisect import bisect, bisect_right, bisect_left def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def S_MAP(): return map(str, input().split()) S_MAP def LIST(): return list(map(int, input().split())) LIST def S_LIST(): return list(map(str, input().split()))
  S_LIST 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 A, B, Q = MAP() A MAP() MAP B Q INT() for i in range(A) for i in range(A) i range(A) range A for i in range(A) INT() INT S = [INT() for i in range(A)] S [INT() for i in range(A)] INT() for i in range(B) for i in range(B) i range(B) range B for i in range(B) INT() INT T = [INT() for i in range(B)] T [INT() for i in range(B)] INT() for i in range(Q) for i in range(Q) i range(Q) range Q for i in range(Q) INT() INT X = [INT() for i in range(Q)] X [INT() for i in range(Q)] S.insert(0, -INF) S.insert S insert 0 -INF INF S.append(INF) S.append S append INF T.insert(0, -INF) T.insert T insert 0 -INF INF T.append(INF) T.append T append INF for x in X:
    s = bisect(S, x)
    t = bisect(T, x)
    # print(s, t)
    # a = min(x - S[s-1], S[s] - x)
    # b = min(x - T[t-1], T[t] - x)
    res = INF
    for a in [S[s-1], S[s]]:
        for b in [T[t-1], T[t]]:
            res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a)))
    print(res)    
     x X s = bisect(S, x) s bisect(S, x) bisect S x t = bisect(T, x) t bisect(T, x) bisect T x res = INF res INF for a in [S[s-1], S[s]]:
        for b in [T[t-1], T[t]]:
            res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a)))
     a [S[s-1], S[s]] S[s-1] S s-1 s 1 S[s] S s for b in [T[t-1], T[t]]:
            res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a)))
     b [T[t-1], T[t]] T[t-1] T t-1 t 1 T[t] T t res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a))) res min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a))) min res min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a)) min abs(a - x) + abs(b - a) abs(a - x) abs a - x a x abs(b - a) abs b - a b a abs(x - b) + abs(b - a) abs(x - b) abs x - b x b abs(b - a) abs b - a b a print(res) print res X = [INT() for i in range(Q)] [INT() for i in range(Q)] X T = [INT() for i in range(B)] [INT() for i in range(B)] T res = INF INF res INF = float('inf') float('inf') INF def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST t = bisect(T, x) bisect(T, x) t def S_MAP(): return map(str, input().split()) def S_MAP(): return map(str, input().split()) S_MAP s = bisect(S, x) bisect(S, x) s def S_LIST(): return list(map(str, input().split()))
  def S_LIST(): return list(map(str, input().split()))
  S_LIST def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) def INT(): return int(input()) INT res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a))) min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a))) res B, Q = MAP() MAP() B mod = 10 ** 9 + 7 10 ** 9 + 7 mod S = [INT() for i in range(A)] [INT() for i in range(A)] S def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP A, B, Q = MAP() MAP() A Q = MAP() MAP() Q
# なぜかうまくいかない
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_right, bisect_left

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, Q = MAP()
S = [INT() for i in range(A)]
T = [INT() for i in range(B)]
X = [INT() for i in range(Q)]
S.insert(0, -INF)
S.append(INF)
T.insert(0, -INF)
T.append(INF)

for x in X:
    s = bisect(S, x)
    t = bisect(T, x)
    # print(s, t)
    # a = min(x - S[s-1], S[s] - x)
    # b = min(x - T[t-1], T[t] - x)
    res = INF
    for a in [S[s-1], S[s]]:
        for b in [T[t-1], T[t]]:
            res = min(res, min(abs(a - x) + abs(b - a), abs(x - b) + abs(b - a)))
    print(res)    
    

