import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

A, B, Q = I()
inf = float("inf")
s = [-inf]+sorted([k() for _ in range(A)])+[inf]
t = [-inf]+sorted([k() for _ in range(B)])+[inf]
aa = []

for i in range(Q):
    q = k()
    S = bisect.bisect(s,q)
    T = bisect.bisect(t,q)
    ans = inf
    for j in [s[S-1],s[S]]:
        for z in [t[T-1],t[T]]:
            x = abs(j-q)+abs(j-z)
            y = abs(z-q)+abs(j-z)
            ans = min(ans,x,y)
    aa.append(ans)

for i in aa:
    print(i) import sys sys import math math import itertools itertools import bisect bisect from copy import copy from collections import deque,Counter from decimal import Decimal def s(): return input() s def k(): return int(input()) k def S(): return input().split() S def I(): return map(int,input().split()) I def X(): return list(input()) X def L(): return list(input().split()) L def l(): return list(map(int,input().split())) l def lcm(a,b): return a*b//math.gcd(a,b) lcm a a b b def gcd(*numbers): reduce(math.gcd, numbers) gcd *numbers sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 count = 0 count 0 ans = 0 ans 0 A, B, Q = I() A I() I B Q inf = float("inf") inf float("inf") float "inf" k() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) k() k s = [-inf]+sorted([k() for _ in range(A)])+[inf] s [-inf]+sorted([k() for _ in range(A)])+[inf] [-inf]+sorted([k() for _ in range(A)]) [-inf] -inf inf sorted([k() for _ in range(A)]) sorted [k() for _ in range(A)] [inf] inf k() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) k() k t = [-inf]+sorted([k() for _ in range(B)])+[inf] t [-inf]+sorted([k() for _ in range(B)])+[inf] [-inf]+sorted([k() for _ in range(B)]) [-inf] -inf inf sorted([k() for _ in range(B)]) sorted [k() for _ in range(B)] [inf] inf aa = [] aa [] for i in range(Q):
    q = k()
    S = bisect.bisect(s,q)
    T = bisect.bisect(t,q)
    ans = inf
    for j in [s[S-1],s[S]]:
        for z in [t[T-1],t[T]]:
            x = abs(j-q)+abs(j-z)
            y = abs(z-q)+abs(j-z)
            ans = min(ans,x,y)
    aa.append(ans) i range(Q) range Q q = k() q k() k S = bisect.bisect(s,q) S bisect.bisect(s,q) bisect.bisect bisect bisect s q T = bisect.bisect(t,q) T bisect.bisect(t,q) bisect.bisect bisect bisect t q ans = inf ans inf for j in [s[S-1],s[S]]:
        for z in [t[T-1],t[T]]:
            x = abs(j-q)+abs(j-z)
            y = abs(z-q)+abs(j-z)
            ans = min(ans,x,y)
     j [s[S-1],s[S]] s[S-1] s S-1 S 1 s[S] s S for z in [t[T-1],t[T]]:
            x = abs(j-q)+abs(j-z)
            y = abs(z-q)+abs(j-z)
            ans = min(ans,x,y)
     z [t[T-1],t[T]] t[T-1] t T-1 T 1 t[T] t T x = abs(j-q)+abs(j-z) x abs(j-q)+abs(j-z) abs(j-q) abs j-q j q abs(j-z) abs j-z j z y = abs(z-q)+abs(j-z) y abs(z-q)+abs(j-z) abs(z-q) abs z-q z q abs(j-z) abs j-z j z ans = min(ans,x,y) ans min(ans,x,y) min ans x y aa.append(ans) aa.append aa append ans for i in aa:
    print(i) i aa print(i) print i def l(): return list(map(int,input().split())) def l(): return list(map(int,input().split())) l ans = 0 0 ans q = k() k() q x = abs(j-q)+abs(j-z) abs(j-q)+abs(j-z) x def I(): return map(int,input().split()) def I(): return map(int,input().split()) I A, B, Q = I() I() A T = bisect.bisect(t,q) bisect.bisect(t,q) T ans = min(ans,x,y) min(ans,x,y) ans inf = float("inf") float("inf") inf def X(): return list(input()) def X(): return list(input()) X y = abs(z-q)+abs(j-z) abs(z-q)+abs(j-z) y s = [-inf]+sorted([k() for _ in range(A)])+[inf] [-inf]+sorted([k() for _ in range(A)])+[inf] s aa = [] [] aa count = 0 0 count def L(): return list(input().split()) def L(): return list(input().split()) L B, Q = I() I() B t = [-inf]+sorted([k() for _ in range(B)])+[inf] [-inf]+sorted([k() for _ in range(B)])+[inf] t mod = 10**9+7 10**9+7 mod S = bisect.bisect(s,q) bisect.bisect(s,q) S def s(): return input() def s(): return input() s Q = I() I() Q def S(): return input().split() def S(): return input().split() S def lcm(a,b): return a*b//math.gcd(a,b) def lcm(a,b): return a*b//math.gcd(a,b) lcm def gcd(*numbers): reduce(math.gcd, numbers) def gcd(*numbers): reduce(math.gcd, numbers) gcd ans = inf inf ans def k(): return int(input()) def k(): return int(input()) k
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

A, B, Q = I()
inf = float("inf")
s = [-inf]+sorted([k() for _ in range(A)])+[inf]
t = [-inf]+sorted([k() for _ in range(B)])+[inf]
aa = []

for i in range(Q):
    q = k()
    S = bisect.bisect(s,q)
    T = bisect.bisect(t,q)
    ans = inf
    for j in [s[S-1],s[S]]:
        for z in [t[T-1],t[T]]:
            x = abs(j-q)+abs(j-z)
            y = abs(z-q)+abs(j-z)
            ans = min(ans,x,y)
    aa.append(ans)

for i in aa:
    print(i)
