from bisect import bisect_left

a , b , q = map(int, input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
s.sort()
t.sort()
s=[float('INF')*(-1)]+s+[float('INF')]
t=[float('INF')*(-1)]+t+[float('INF')]
for i in range(q):
    x = int(input())
    sp=bisect_left(s,x)-1
    tp=bisect_left(t,x)-1
    s1=s[sp]
    t1=t[tp]
    s2=s[sp+1]
    t2=t[tp+1]
    print(min(max(x-s1,x-t1),max(s2-x,t2-x),x-s1+t2-s1,x-t1+s2-t1,s2-x+s2-t1,t2-x+t2-s1)) from bisect import bisect_left a , b , q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q 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 = [int(input()) for i in range(a)] s [int(input()) for i in range(a)] 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 = [int(input()) for i in range(b)] t [int(input()) for i in range(b)] s.sort() s.sort s sort t.sort() t.sort t sort s=[float('INF')*(-1)]+s+[float('INF')] s [float('INF')*(-1)]+s+[float('INF')] [float('INF')*(-1)]+s [float('INF')*(-1)] float('INF')*(-1) float('INF') float 'INF' -1 s [float('INF')] float('INF') float 'INF' t=[float('INF')*(-1)]+t+[float('INF')] t [float('INF')*(-1)]+t+[float('INF')] [float('INF')*(-1)]+t [float('INF')*(-1)] float('INF')*(-1) float('INF') float 'INF' -1 t [float('INF')] float('INF') float 'INF' for i in range(q):
    x = int(input())
    sp=bisect_left(s,x)-1
    tp=bisect_left(t,x)-1
    s1=s[sp]
    t1=t[tp]
    s2=s[sp+1]
    t2=t[tp+1]
    print(min(max(x-s1,x-t1),max(s2-x,t2-x),x-s1+t2-s1,x-t1+s2-t1,s2-x+s2-t1,t2-x+t2-s1)) i range(q) range q x = int(input()) x int(input()) int input() input sp=bisect_left(s,x)-1 sp bisect_left(s,x)-1 bisect_left(s,x) bisect_left s x 1 tp=bisect_left(t,x)-1 tp bisect_left(t,x)-1 bisect_left(t,x) bisect_left t x 1 s1=s[sp] s1 s[sp] s sp t1=t[tp] t1 t[tp] t tp s2=s[sp+1] s2 s[sp+1] s sp+1 sp 1 t2=t[tp+1] t2 t[tp+1] t tp+1 tp 1 print(min(max(x-s1,x-t1),max(s2-x,t2-x),x-s1+t2-s1,x-t1+s2-t1,s2-x+s2-t1,t2-x+t2-s1)) print min(max(x-s1,x-t1),max(s2-x,t2-x),x-s1+t2-s1,x-t1+s2-t1,s2-x+s2-t1,t2-x+t2-s1) min max(x-s1,x-t1) max x-s1 x s1 x-t1 x t1 max(s2-x,t2-x) max s2-x s2 x t2-x t2 x x-s1+t2-s1 x-s1+t2 x-s1 x s1 t2 s1 x-t1+s2-t1 x-t1+s2 x-t1 x t1 s2 t1 s2-x+s2-t1 s2-x+s2 s2-x s2 x s2 t1 t2-x+t2-s1 t2-x+t2 t2-x t2 x t2 s1 b , q = map(int, input().split()) map(int, input().split()) b s = [int(input()) for i in range(a)] [int(input()) for i in range(a)] s q = map(int, input().split()) map(int, input().split()) q s=[float('INF')*(-1)]+s+[float('INF')] [float('INF')*(-1)]+s+[float('INF')] s tp=bisect_left(t,x)-1 bisect_left(t,x)-1 tp t2=t[tp+1] t[tp+1] t2 t = [int(input()) for i in range(b)] [int(input()) for i in range(b)] t sp=bisect_left(s,x)-1 bisect_left(s,x)-1 sp x = int(input()) int(input()) x s1=s[sp] s[sp] s1 a , b , q = map(int, input().split()) map(int, input().split()) a t1=t[tp] t[tp] t1 t=[float('INF')*(-1)]+t+[float('INF')] [float('INF')*(-1)]+t+[float('INF')] t s2=s[sp+1] s[sp+1] s2
from bisect import bisect_left

a , b , q = map(int, input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
s.sort()
t.sort()
s=[float('INF')*(-1)]+s+[float('INF')]
t=[float('INF')*(-1)]+t+[float('INF')]
for i in range(q):
    x = int(input())
    sp=bisect_left(s,x)-1
    tp=bisect_left(t,x)-1
    s1=s[sp]
    t1=t[tp]
    s2=s[sp+1]
    t2=t[tp+1]
    print(min(max(x-s1,x-t1),max(s2-x,t2-x),x-s1+t2-s1,x-t1+s2-t1,s2-x+s2-t1,t2-x+t2-s1))
