import bisect
inf = 10**18
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()))
s = [-1*inf] + s + [inf]
t = [-1*inf] + t + [inf]
for i in range(q):
  x = int(input())
  index_s = bisect.bisect_left(s, x)
  index_t = bisect.bisect_right(t, x)
  s1 = abs(s[index_s]-x)#xより右側で一番近い神社までの距離
  s2 = abs(s[index_s-1]-x)#xより左側で~
  t1 = abs(t[index_t]-x)#xより右側で~寺~
  t2 = abs(t[index_t-1]-x)#xより左側で~
  print(min([max(s1, t1), max(s2, t2), 2*s1+t2, 2*t2+s1, 2*s2+t1, 2*t1+s2])) import bisect bisect inf = 10**18 inf 10**18 10 18 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 s = [-1*inf] + s + [inf] s [-1*inf] + s + [inf] [-1*inf] + s [-1*inf] -1*inf -1 inf s [inf] inf t = [-1*inf] + t + [inf] t [-1*inf] + t + [inf] [-1*inf] + t [-1*inf] -1*inf -1 inf t [inf] inf for i in range(q):
  x = int(input())
  index_s = bisect.bisect_left(s, x)
  index_t = bisect.bisect_right(t, x)
  s1 = abs(s[index_s]-x)#xより右側で一番近い神社までの距離
  s2 = abs(s[index_s-1]-x)#xより左側で~
  t1 = abs(t[index_t]-x)#xより右側で~寺~
  t2 = abs(t[index_t-1]-x)#xより左側で~
  print(min([max(s1, t1), max(s2, t2), 2*s1+t2, 2*t2+s1, 2*s2+t1, 2*t1+s2])) i range(q) range q x = int(input()) x int(input()) int input() input index_s = bisect.bisect_left(s, x) index_s bisect.bisect_left(s, x) bisect.bisect_left bisect bisect_left s x index_t = bisect.bisect_right(t, x) index_t bisect.bisect_right(t, x) bisect.bisect_right bisect bisect_right t x s1 = abs(s[index_s]-x) s1 abs(s[index_s]-x) abs s[index_s]-x s[index_s] s index_s x s2 = abs(s[index_s-1]-x) s2 abs(s[index_s-1]-x) abs s[index_s-1]-x s[index_s-1] s index_s-1 index_s 1 x t1 = abs(t[index_t]-x) t1 abs(t[index_t]-x) abs t[index_t]-x t[index_t] t index_t x t2 = abs(t[index_t-1]-x) t2 abs(t[index_t-1]-x) abs t[index_t-1]-x t[index_t-1] t index_t-1 index_t 1 x print(min([max(s1, t1), max(s2, t2), 2*s1+t2, 2*t2+s1, 2*s2+t1, 2*t1+s2])) print min([max(s1, t1), max(s2, t2), 2*s1+t2, 2*t2+s1, 2*s2+t1, 2*t1+s2]) min [max(s1, t1), max(s2, t2), 2*s1+t2, 2*t2+s1, 2*s2+t1, 2*t1+s2] max(s1, t1) max s1 t1 max(s2, t2) max s2 t2 2*s1+t2 2*s1 2 s1 t2 2*t2+s1 2*t2 2 t2 s1 2*s2+t1 2*s2 2 s2 t1 2*t1+s2 2*t1 2 t1 s2 index_s = bisect.bisect_left(s, x) bisect.bisect_left(s, x) index_s s2 = abs(s[index_s-1]-x) abs(s[index_s-1]-x) s2 x = int(input()) int(input()) x s = [] [] s t = [-1*inf] + t + [inf] [-1*inf] + t + [inf] t s = [-1*inf] + s + [inf] [-1*inf] + s + [inf] s q = map(int, input().split()) map(int, input().split()) q inf = 10**18 10**18 inf t = [] [] t t1 = abs(t[index_t]-x) abs(t[index_t]-x) t1 b, q = map(int, input().split()) map(int, input().split()) b a, b, q = map(int, input().split()) map(int, input().split()) a index_t = bisect.bisect_right(t, x) bisect.bisect_right(t, x) index_t s1 = abs(s[index_s]-x) abs(s[index_s]-x) s1 t2 = abs(t[index_t-1]-x) abs(t[index_t-1]-x) t2
import bisect
inf = 10**18
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()))
s = [-1*inf] + s + [inf]
t = [-1*inf] + t + [inf]
for i in range(q):
  x = int(input())
  index_s = bisect.bisect_left(s, x)
  index_t = bisect.bisect_right(t, x)
  s1 = abs(s[index_s]-x)#xより右側で一番近い神社までの距離
  s2 = abs(s[index_s-1]-x)#xより左側で~
  t1 = abs(t[index_t]-x)#xより右側で~寺~
  t2 = abs(t[index_t-1]-x)#xより左側で~
  print(min([max(s1, t1), max(s2, t2), 2*s1+t2, 2*t2+s1, 2*s2+t1, 2*t1+s2]))