"use strict";
function Main(input) {
    let lines = input.split("\n");
    let ABQ = lines.shift().split(/\s/).map((v) => v - 0);
    let A = ABQ[0];
    let B = ABQ[1];
    let Q = ABQ[2];
    let Si = [];
    for (let a = 1; a <= A; a++) {
        Si.push(lines.shift() - 0);
    }
    let Ti = [];
    for (let b = 1; b <= B; b++) {
        Ti.push(lines.shift() - 0);
    }
    let Qi = [];
    for (let q = 1; q <= Q; q++) {
        Qi.push(lines.shift() - 0);
    }
    for (let n = 0; n < Q; n++) {
        let q = Qi[n];
        let si = Si.map((v) => Math.abs(q - v));
        let ti = Ti.map((v) => Math.abs(q - v));
        let Smin = Math.min(...si); let Sp = si.reduce((a, v, i) => (v == Smin) ? i : 0);
        let Tmin = Math.min(...ti); let Tp = ti.reduce((a, v, i) => (v == Tmin) ? i : 0);
        let sum = 0;
        if (Smin < Tmin) {
            ti = Ti.map((v) => Math.abs(Si[Sp] - v));
            sum = Smin + Math.min(...ti);
        } else 
        if (Smin > Tmin) {
            let si = Si.map((v) => Math.abs(Ti[Tp] - v));
            sum = Tmin + Math.min(...si);
        }
        console.log(sum);
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
