import bisect,sys
input = sys.stdin.readline
a,b,q = map(int,input().split())
inf = 10**18
s = [-inf]+[int(input()) for i in range(a)]+[inf]
t = [-inf]+[int(input()) for i in range(b)]+[inf]
for i in range(q):
  x = int(input())
  i = bisect.bisect_right(s,x)
  j = bisect.bisect_right(t,x)
  print(min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1])) import bisect,sys bisect sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline a,b,q = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q inf = 10**18 inf 10**18 10 18 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 = [-inf]+[int(input()) for i in range(a)]+[inf] s [-inf]+[int(input()) for i in range(a)]+[inf] [-inf]+[int(input()) for i in range(a)] [-inf] -inf inf [int(input()) for i in range(a)] [inf] inf 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 = [-inf]+[int(input()) for i in range(b)]+[inf] t [-inf]+[int(input()) for i in range(b)]+[inf] [-inf]+[int(input()) for i in range(b)] [-inf] -inf inf [int(input()) for i in range(b)] [inf] inf for i in range(q):
  x = int(input())
  i = bisect.bisect_right(s,x)
  j = bisect.bisect_right(t,x)
  print(min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1])) i range(q) range q x = int(input()) x int(input()) int input() input i = bisect.bisect_right(s,x) i bisect.bisect_right(s,x) bisect.bisect_right bisect bisect_right s x j = bisect.bisect_right(t,x) j bisect.bisect_right(t,x) bisect.bisect_right bisect bisect_right t x print(min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1])) print min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1]) min max(s[i],t[j])-x max(s[i],t[j]) max s[i] s i t[j] t j x x-min(s[i-1],t[j-1]) x min(s[i-1],t[j-1]) min s[i-1] s i-1 i 1 t[j-1] t j-1 j 1 min(s[i]-x,x-t[j-1])+s[i]-t[j-1] min(s[i]-x,x-t[j-1])+s[i] min(s[i]-x,x-t[j-1]) min s[i]-x s[i] s i x x-t[j-1] x t[j-1] t j-1 j 1 s[i] s i t[j-1] t j-1 j 1 min(t[j]-x,x-s[i-1])+t[j]-s[i-1] min(t[j]-x,x-s[i-1])+t[j] min(t[j]-x,x-s[i-1]) min t[j]-x t[j] t j x x-s[i-1] x s[i-1] s i-1 i 1 t[j] t j s[i-1] s i-1 i 1 j = bisect.bisect_right(t,x) bisect.bisect_right(t,x) j input = sys.stdin.readline sys.stdin.readline input s = [-inf]+[int(input()) for i in range(a)]+[inf] [-inf]+[int(input()) for i in range(a)]+[inf] s inf = 10**18 10**18 inf t = [-inf]+[int(input()) for i in range(b)]+[inf] [-inf]+[int(input()) for i in range(b)]+[inf] t x = int(input()) int(input()) x a,b,q = map(int,input().split()) map(int,input().split()) a b,q = map(int,input().split()) map(int,input().split()) b q = map(int,input().split()) map(int,input().split()) q i = bisect.bisect_right(s,x) bisect.bisect_right(s,x) i
import bisect,sys
input = sys.stdin.readline
a,b,q = map(int,input().split())
inf = 10**18
s = [-inf]+[int(input()) for i in range(a)]+[inf]
t = [-inf]+[int(input()) for i in range(b)]+[inf]
for i in range(q):
  x = int(input())
  i = bisect.bisect_right(s,x)
  j = bisect.bisect_right(t,x)
  print(min(max(s[i],t[j])-x,x-min(s[i-1],t[j-1]),min(s[i]-x,x-t[j-1])+s[i]-t[j-1],min(t[j]-x,x-s[i-1])+t[j]-s[i-1]))