import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
A, B, Q = map(int, input().split())
a = [-10 ** 18] + [int(input()) for _ in range(A)] + [10 ** 18]
b = [-10 ** 18] + [int(input()) for _ in range(B)] + [10 ** 18]
for _ in range(Q):
  x = int(input())
  ra = bl(a, x)
  rb = bl(b, x)
  la = ra - 1
  lb = rb - 1
  res = 10 ** 18
  res = min(res, max(abs(a[ra] - x), abs(b[rb] - x)))
  res = min(res, max(abs(a[la] - x), abs(b[lb] - x)))
  res = min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2)
  res = min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2)
  print(res) import sys sys from bisect import bisect_left as bl 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 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input a = [-10 ** 18] + [int(input()) for _ in range(A)] + [10 ** 18] a [-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 b = [-10 ** 18] + [int(input()) for _ in range(B)] + [10 ** 18] b [-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 for _ in range(Q):
  x = int(input())
  ra = bl(a, x)
  rb = bl(b, x)
  la = ra - 1
  lb = rb - 1
  res = 10 ** 18
  res = min(res, max(abs(a[ra] - x), abs(b[rb] - x)))
  res = min(res, max(abs(a[la] - x), abs(b[lb] - x)))
  res = min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2)
  res = min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2)
  print(res) _ range(Q) range Q x = int(input()) x int(input()) int input() input ra = bl(a, x) ra bl(a, x) bl a x rb = bl(b, x) rb bl(b, x) bl b x la = ra - 1 la ra - 1 ra 1 lb = rb - 1 lb rb - 1 rb 1 res = 10 ** 18 res 10 ** 18 10 18 res = min(res, max(abs(a[ra] - x), abs(b[rb] - x))) res min(res, max(abs(a[ra] - x), abs(b[rb] - x))) min res max(abs(a[ra] - x), abs(b[rb] - x)) max abs(a[ra] - x) abs a[ra] - x a[ra] a ra x abs(b[rb] - x) abs b[rb] - x b[rb] b rb x res = min(res, max(abs(a[la] - x), abs(b[lb] - x))) res min(res, max(abs(a[la] - x), abs(b[lb] - x))) min res max(abs(a[la] - x), abs(b[lb] - x)) max abs(a[la] - x) abs a[la] - x a[la] a la x abs(b[lb] - x) abs b[lb] - x b[lb] b lb x res = min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2) res min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2) min res max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2 max(abs(a[la] - x), abs(b[rb] - x)) max abs(a[la] - x) abs a[la] - x a[la] a la x abs(b[rb] - x) abs b[rb] - x b[rb] b rb x min(abs(a[la] - x), abs(b[rb] - x)) * 2 min(abs(a[la] - x), abs(b[rb] - x)) min abs(a[la] - x) abs a[la] - x a[la] a la x abs(b[rb] - x) abs b[rb] - x b[rb] b rb x 2 res = min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2) res min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2) min res max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2 max(abs(a[ra] - x), abs(b[lb] - x)) max abs(a[ra] - x) abs a[ra] - x a[ra] a ra x abs(b[lb] - x) abs b[lb] - x b[lb] b lb x min(abs(a[ra] - x), abs(b[lb] - x)) * 2 min(abs(a[ra] - x), abs(b[lb] - x)) min abs(a[ra] - x) abs a[ra] - x a[ra] a ra x abs(b[lb] - x) abs b[lb] - x b[lb] b lb x 2 print(res) print res res = min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2) min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2) res lb = rb - 1 rb - 1 lb res = min(res, max(abs(a[la] - x), abs(b[lb] - x))) min(res, max(abs(a[la] - x), abs(b[lb] - x))) res B, Q = map(int, input().split()) map(int, input().split()) B la = ra - 1 ra - 1 la res = min(res, max(abs(a[ra] - x), abs(b[rb] - x))) min(res, max(abs(a[ra] - x), abs(b[rb] - x))) res res = min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2) min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2) res input = sys.stdin.readline sys.stdin.readline input Q = map(int, input().split()) map(int, input().split()) Q a = [-10 ** 18] + [int(input()) for _ in range(A)] + [10 ** 18] [-10 ** 18] + [int(input()) for _ in range(A)] + [10 ** 18] a ra = bl(a, x) bl(a, x) ra A, B, Q = map(int, input().split()) map(int, input().split()) A x = int(input()) int(input()) x rb = bl(b, x) bl(b, x) rb b = [-10 ** 18] + [int(input()) for _ in range(B)] + [10 ** 18] [-10 ** 18] + [int(input()) for _ in range(B)] + [10 ** 18] b res = 10 ** 18 10 ** 18 res
import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
A, B, Q = map(int, input().split())
a = [-10 ** 18] + [int(input()) for _ in range(A)] + [10 ** 18]
b = [-10 ** 18] + [int(input()) for _ in range(B)] + [10 ** 18]
for _ in range(Q):
  x = int(input())
  ra = bl(a, x)
  rb = bl(b, x)
  la = ra - 1
  lb = rb - 1
  res = 10 ** 18
  res = min(res, max(abs(a[ra] - x), abs(b[rb] - x)))
  res = min(res, max(abs(a[la] - x), abs(b[lb] - x)))
  res = min(res, max(abs(a[la] - x), abs(b[rb] - x)) + min(abs(a[la] - x), abs(b[rb] - x)) * 2)
  res = min(res, max(abs(a[ra] - x), abs(b[lb] - x)) + min(abs(a[ra] - x), abs(b[lb] - x)) * 2)
  print(res)