import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

alias pred = (a,b) => a < b;

void main() {
    const tmp = readln.split.to!(long[]);
    const A = tmp[0], B = tmp[1], Q = tmp[2];
    auto ss = A.iota.map!(_ => readln.chomp.to!long).array.sort!(pred);
    auto ts = B.iota.map!(_ => readln.chomp.to!long).array.sort!(pred);
    const xs = Q.iota.map!(_ => readln.chomp.to!long).array;

    Nullable!long getNearest(typeof(ss) xs, long x, bool left) {
        auto a = left ? xs.lowerBound(x) : xs.upperBound(x);

        if (a.empty) return typeof(return).init;
        return typeof(return)(left ? a.back : a.front);
    }

    Nullable!long func(long x, typeof(ss) as, typeof(ss) bs, bool leftA, bool leftB) {
        auto a = getNearest(as, x, leftA);
        if (a.isNull) return typeof(return).init;

        auto b = getNearest(bs, a, leftB);
        if (b.isNull) return typeof(return).init;

        auto s = a.get;
        auto t = b.get;
        return typeof(return)(abs(x-s) + abs(s-t));
    }

    foreach (i; 0..Q) {
        const x = xs[i];
        [
            func(x, ss, ts, false, false),
            func(x, ss, ts, false, true),
            func(x, ss, ts, true, false),
            func(x, ss, ts, true, true),
            func(x, ts, ss, false, false),
            func(x, ts, ss, false, true),
            func(x, ts, ss, true, false),
            func(x, ts, ss, true, true),
        ]
            .filter!(a => !a.isNull)
            .map!(a => a.get())
            .reduce!min.writeln;
    }
}

