#!/usr/bin/env python3
import bisect

INF = 10 ** 18


def solve(s,t,x):
  ans = [0]*len(x)
  for i in range(len(x)):
    b = bisect.bisect_right(s,x[i])
    d = bisect.bisect_right(t,x[i])
    res = INF
    for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
    ans[i] = res
  return ans



def main():
  A,B,Q = map(int,input().split())
  s = [-10**18] + [int(input()) for _ in range(A)] + [10**18]
  t = [-10**18] + [int(input()) for _ in range(B)] + [10**18]
  x = [int(input()) for _ in range(Q)]
  ans = solve(s,t,x)
  for i in range(Q):
    print(ans[i])
  return

if __name__ == '__main__':
  main() import bisect bisect INF = 10 ** 18 INF 10 ** 18 10 18 def solve(s,t,x):
  ans = [0]*len(x)
  for i in range(len(x)):
    b = bisect.bisect_right(s,x[i])
    d = bisect.bisect_right(t,x[i])
    res = INF
    for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
    ans[i] = res
  return ans solve ans = [0]*len(x) ans [0]*len(x) [0] 0 len(x) len x for i in range(len(x)):
    b = bisect.bisect_right(s,x[i])
    d = bisect.bisect_right(t,x[i])
    res = INF
    for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
    ans[i] = res
   i range(len(x)) range len(x) len x b = bisect.bisect_right(s,x[i]) b bisect.bisect_right(s,x[i]) bisect.bisect_right bisect bisect_right s x[i] x i d = bisect.bisect_right(t,x[i]) d bisect.bisect_right(t,x[i]) bisect.bisect_right bisect bisect_right t x[i] x i res = INF res INF for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
     S [s[b-1],s[b]] s[b-1] s b-1 b 1 s[b] s b for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
     T [t[d-1],t[d]] t[d-1] t d-1 d 1 t[d] t d res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S)) res min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S)) min res abs(S-x[i]) + abs(T-S) abs(S-x[i]) abs S-x[i] S x[i] x i abs(T-S) abs T-S T S abs(T-x[i])+abs(T-S) abs(T-x[i]) abs T-x[i] T x[i] x i abs(T-S) abs T-S T S ans[i] = res ans[i] ans i res return ans ans s s t t x x def main():
  A,B,Q = map(int,input().split())
  s = [-10**18] + [int(input()) for _ in range(A)] + [10**18]
  t = [-10**18] + [int(input()) for _ in range(B)] + [10**18]
  x = [int(input()) for _ in range(Q)]
  ans = solve(s,t,x)
  for i in range(Q):
    print(ans[i])
  return main A,B,Q = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input s = [-10**18] + [int(input()) for _ in range(A)] + [10**18] s [-10**18] + [int(input()) for _ in range(A)] + [10**18] [-10**18] + [int(input()) for _ in range(A)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(A)] [10**18] 10**18 10 18 int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t = [-10**18] + [int(input()) for _ in range(B)] + [10**18] t [-10**18] + [int(input()) for _ in range(B)] + [10**18] [-10**18] + [int(input()) for _ in range(B)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(B)] [10**18] 10**18 10 18 int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input x = [int(input()) for _ in range(Q)] x [int(input()) for _ in range(Q)] ans = solve(s,t,x) ans solve(s,t,x) solve s t x for i in range(Q):
    print(ans[i])
   i range(Q) range Q print(ans[i]) print ans[i] ans i return if __name__ == '__main__':
  main() __name__ == '__main__' __name__ '__main__' main() main def solve(s,t,x):
  ans = [0]*len(x)
  for i in range(len(x)):
    b = bisect.bisect_right(s,x[i])
    d = bisect.bisect_right(t,x[i])
    res = INF
    for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
    ans[i] = res
  return ans def solve(s,t,x):
  ans = [0]*len(x)
  for i in range(len(x)):
    b = bisect.bisect_right(s,x[i])
    d = bisect.bisect_right(t,x[i])
    res = INF
    for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
    ans[i] = res
  return ans solve INF = 10 ** 18 10 ** 18 INF def main():
  A,B,Q = map(int,input().split())
  s = [-10**18] + [int(input()) for _ in range(A)] + [10**18]
  t = [-10**18] + [int(input()) for _ in range(B)] + [10**18]
  x = [int(input()) for _ in range(Q)]
  ans = solve(s,t,x)
  for i in range(Q):
    print(ans[i])
  return def main():
  A,B,Q = map(int,input().split())
  s = [-10**18] + [int(input()) for _ in range(A)] + [10**18]
  t = [-10**18] + [int(input()) for _ in range(B)] + [10**18]
  x = [int(input()) for _ in range(Q)]
  ans = solve(s,t,x)
  for i in range(Q):
    print(ans[i])
  return main
#!/usr/bin/env python3
import bisect

INF = 10 ** 18


def solve(s,t,x):
  ans = [0]*len(x)
  for i in range(len(x)):
    b = bisect.bisect_right(s,x[i])
    d = bisect.bisect_right(t,x[i])
    res = INF
    for S in [s[b-1],s[b]]:
      for T in [t[d-1],t[d]]:
        res = min(res,abs(S-x[i]) + abs(T-S),abs(T-x[i])+abs(T-S))
    ans[i] = res
  return ans



def main():
  A,B,Q = map(int,input().split())
  s = [-10**18] + [int(input()) for _ in range(A)] + [10**18]
  t = [-10**18] + [int(input()) for _ in range(B)] + [10**18]
  x = [int(input()) for _ in range(Q)]
  ans = solve(s,t,x)
  for i in range(Q):
    print(ans[i])
  return

if __name__ == '__main__':
  main()
