import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

long[] s, t;

void main()
{
    long A, B, Q;
    scan(A, B, Q);
    s = new long[](A);
    t = new long[](B);
    foreach (i; 0 .. A)
        scan(s[i]);
    foreach (i; 0 .. B)
        scan(t[i]);

    foreach (_; 0 .. Q)
    {
        long x;
        scan(x);
        solve(x).writeln();
    }
}

long solve(long x)
{
    if (s.length <= 2 && t.length <= 2)
        return eval(s, t, x);
    if (x <= s[0] && x <= t[0])
        return eval(s[0 .. 1], t[0 .. 1], x);
    if (s[$ - 1] <= x && t[$ - 1] <= x)
        return eval(s[$ - 1 .. $], t[$ - 1 .. $], x);

    long si = bisect(x, s);
    long ti = bisect(x, t);
    return eval(s[si .. si + 2], t[ti .. ti + 2], x);

}

long bisect(long x, long[] ary)
{
    long yes, no;
    yes = 0;
    no = ary.length;
    while (1 < no - yes)
    {
        long mid = (yes + no) / 2;
        if (ary[mid] < x)
        {
            yes = mid;
        }
        else
        {
            no = mid;
        }
    }
    return yes;
}

long eval(long[] ss, long[] ts, long x)
{
    long ans = long.max;
    foreach (s; ss)
        foreach (t; ts)
        {
            ans = ans.min(min(abs(x - s), abs(x - t)) + abs(s - t));
        }
    return ans;
}
