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

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

auto minElement(R)(R r) {
    return r.reduce!((a, b) => min(a, b));
}


void main() {
	auto nums = readNums();
	immutable a = nums[0];
	immutable b = nums[1];
	immutable q = nums[2];
	auto ss = assumeSorted(iota(0, a).map!((i) => readNums!long()[0]).array);
	auto ts = assumeSorted(iota(0, b).map!((i) => readNums!long()[0]).array);
	auto xs = iota(0, q).map!((i) => readNums!long()[0]).array;
	foreach(x; xs) {
		long distSW = -1;
		long distSE = -1;
		auto foundS = ss.trisect(x);
		if(!foundS[1].empty) {
			distSW = 0;
			distSE = 0;
		} else {
			if(!foundS[0].empty) {
				distSW = abs(foundS[0][$ - 1] - x);
			}
			if(!foundS[2].empty) {
				distSE = foundS[2][0] - x;
			}
		}
		
		long distTW = -1;
		long distTE = -1;
		auto foundT = ts.trisect(x);
		if(!foundT[1].empty) {
			distTW = 0;
			distTE = 0;
		} else {
			if(!foundT[0].empty) {
				distTW = abs(foundT[0][$ - 1] - x);
			}
			if(!foundT[2].empty) {
				distTE = foundT[2][0] - x;
			}
		}
		
		ulong minDist = long.max;
		if(distSW >= 0 && distTW >= 0) {
			minDist = min(minDist, max(distSW, distTW));
		}
		if(distSE >= 0 && distTE >= 0) {
			minDist = min(minDist, max(distSE, distTE));
		}
		if(distSW >= 0 && distTE >= 0) {
			minDist = min(minDist, distSW * 2 + distTE);
		}
		if(distTE >= 0 && distSW >= 0) {
			minDist = min(minDist, distTE * 2 + distSW);
		}
		writefln("%s", minDist);
	}
}