import bisect

a,b,q=map(int,input().split())
s = []
t = []
for i in range(a):
  s.append(int(input()))
for i in range(b):
  t.append(int(input()))
for _ in range(q):
  x = int(input())
  
  ans = [0,0,0]
  
  i = bisect.bisect_left(s,x)
  if i == 0:
    sl = 100000000000
  else:
    sl = abs(s[i-1]-x)
  if i == a:
    sr = 100000000000
  else:
    sr = abs(s[i]-x)
  i = bisect.bisect_left(t,x)
  if i == 0:
    tl = 100000000000
  else:
    tl = abs(t[i-1]-x)
  if i == b:
    tr = 100000000000
  else:
    tr = abs(t[i]-x)
  ans[0] = max(tl,sl)
  ans[1] = max(tr,sr)
  ans[2] = min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl)
  print(min(ans)) import bisect bisect a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q s = [] s [] t = [] t [] for i in range(a):
  s.append(int(input())) i range(a) range a s.append(int(input())) s.append s append int(input()) int input() input for i in range(b):
  t.append(int(input())) i range(b) range b t.append(int(input())) t.append t append int(input()) int input() input for _ in range(q):
  x = int(input())
  
  ans = [0,0,0]
  
  i = bisect.bisect_left(s,x)
  if i == 0:
    sl = 100000000000
  else:
    sl = abs(s[i-1]-x)
  if i == a:
    sr = 100000000000
  else:
    sr = abs(s[i]-x)
  i = bisect.bisect_left(t,x)
  if i == 0:
    tl = 100000000000
  else:
    tl = abs(t[i-1]-x)
  if i == b:
    tr = 100000000000
  else:
    tr = abs(t[i]-x)
  ans[0] = max(tl,sl)
  ans[1] = max(tr,sr)
  ans[2] = min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl)
  print(min(ans)) _ range(q) range q x = int(input()) x int(input()) int input() input ans = [0,0,0] ans [0,0,0] 0 0 0 i = bisect.bisect_left(s,x) i bisect.bisect_left(s,x) bisect.bisect_left bisect bisect_left s x if i == 0:
    sl = 100000000000
  else:
    sl = abs(s[i-1]-x)
   i == 0 i 0 sl = 100000000000 sl 100000000000 sl = abs(s[i-1]-x) sl abs(s[i-1]-x) abs s[i-1]-x s[i-1] s i-1 i 1 x if i == a:
    sr = 100000000000
  else:
    sr = abs(s[i]-x)
   i == a i a sr = 100000000000 sr 100000000000 sr = abs(s[i]-x) sr abs(s[i]-x) abs s[i]-x s[i] s i x i = bisect.bisect_left(t,x) i bisect.bisect_left(t,x) bisect.bisect_left bisect bisect_left t x if i == 0:
    tl = 100000000000
  else:
    tl = abs(t[i-1]-x)
   i == 0 i 0 tl = 100000000000 tl 100000000000 tl = abs(t[i-1]-x) tl abs(t[i-1]-x) abs t[i-1]-x t[i-1] t i-1 i 1 x if i == b:
    tr = 100000000000
  else:
    tr = abs(t[i]-x)
   i == b i b tr = 100000000000 tr 100000000000 tr = abs(t[i]-x) tr abs(t[i]-x) abs t[i]-x t[i] t i x ans[0] = max(tl,sl) ans[0] ans 0 max(tl,sl) max tl sl ans[1] = max(tr,sr) ans[1] ans 1 max(tr,sr) max tr sr ans[2] = min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl) ans[2] ans 2 min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl) min 2*tl+sr 2*tl 2 tl sr 2*sl+tr 2*sl 2 sl tr 2*sr+tl 2*sr 2 sr tl 2*tr+sl 2*tr 2 tr sl print(min(ans)) print min(ans) min ans sr = abs(s[i]-x) abs(s[i]-x) sr t = [] [] t i = bisect.bisect_left(t,x) bisect.bisect_left(t,x) i tl = abs(t[i-1]-x) abs(t[i-1]-x) tl s = [] [] s tr = 100000000000 100000000000 tr b,q=map(int,input().split()) map(int,input().split()) b ans = [0,0,0] [0,0,0] ans sl = abs(s[i-1]-x) abs(s[i-1]-x) sl tr = abs(t[i]-x) abs(t[i]-x) tr x = int(input()) int(input()) x sl = 100000000000 100000000000 sl a,b,q=map(int,input().split()) map(int,input().split()) a q=map(int,input().split()) map(int,input().split()) q sr = 100000000000 100000000000 sr i = bisect.bisect_left(s,x) bisect.bisect_left(s,x) i tl = 100000000000 100000000000 tl
import bisect

a,b,q=map(int,input().split())
s = []
t = []
for i in range(a):
  s.append(int(input()))
for i in range(b):
  t.append(int(input()))
for _ in range(q):
  x = int(input())
  
  ans = [0,0,0]
  
  i = bisect.bisect_left(s,x)
  if i == 0:
    sl = 100000000000
  else:
    sl = abs(s[i-1]-x)
  if i == a:
    sr = 100000000000
  else:
    sr = abs(s[i]-x)
  i = bisect.bisect_left(t,x)
  if i == 0:
    tl = 100000000000
  else:
    tl = abs(t[i-1]-x)
  if i == b:
    tr = 100000000000
  else:
    tr = abs(t[i]-x)
  ans[0] = max(tl,sl)
  ans[1] = max(tr,sr)
  ans[2] = min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl)
  print(min(ans))