open Printf open Scanf
open Array

let iia k = init k (fun _ -> scanf " %d" @@ fun v -> v)
let binary_search ng ok f = let d = if ng <= ok then 1 else -1 in
  let rec f0 ng ok =
    if abs (ok - ng) <= 1 then ok
    else let mid = ng + (ok - ng) / 2 in if f mid then f0 ng mid else f0 mid ok
  in f0 (ng-d) (ok+d)

let inf = 1000000000000
let hoge a =
  let n = length a + 2 in
  init n (fun i ->
  if i=0 then -inf
  else if i=n-1 then inf
  else a.(i-1))
let right a v = get a @@ binary_search 0 (length a - 1) (fun i -> a.(i) > v)
let left  a v = get a @@ binary_search (length a - 1) 0 (fun i -> a.(i) < v)

let () = scanf " %d %d %d" @@ fun a b q ->
  let s = hoge @@ iia a in
  let t = hoge @@ iia b in
  let x = iia q in
  sort compare s;
  sort compare t;
  iter (fun x ->
    let ls,rs = left s x, right s x in
    let lt,rt = left t x, right t x in
    let res = [|
      abs (x - min ls lt);
      abs (x-ls) + abs (rt-ls);
      abs (max rs rt - x);
      abs (rs-x) + abs (rs-lt);
      abs (x-lt) + abs (rs-lt);
      abs (rt-x) + abs (rt-ls);
    |] in
    printf "%d\n" @@ fold_left min inf res
  ) x


