"use strict";

// read lines from stdin
const input = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .split("\n");

const firstline = input[0].split(" ").map(val => parseInt(val, 10));
const A = firstline[0];
const B = firstline[1];
const Q = firstline[2];

const shrines = [];
const temples = [];

for (let i = 0; i < A; i++) {
  shrines.push(parseInt(input[i + 1], 10));
}

for (let i = 0; i < B; i++) {
  temples.push(parseInt(input[i + A + 1], 10));
}

const distanceFromShrines = shrines.map((val) => ({
  dist: val,
  toTemple: Math.min(...temples.map((temp) => Math.abs(val - temp))),
}));
const distanceFromTemples = temples.map((val) => ({
  dist: val,
  toShrine: Math.min(...shrines.map((shrine) => Math.abs(val - shrine))),
}))

for (let i = 0; i < Q; i++) {
  const start = parseInt(input[i + A + B + 1], 10);

  const firstShrine = Math.min(...distanceFromShrines.map((val) => Math.abs(val.dist - start) + val.toTemple));
  const firstTemple = Math.min(...distanceFromTemples.map((val) => Math.abs(val.dist - start) + val.toShrine));

  console.log(firstShrine > firstTemple ? firstTemple : firstShrine);
}
