import std.stdio;
import std.math;
import std.algorithm;
import std.conv;

long binsearch(long[] arr, long v) {
	long i = arr.length.to!long / 2;
	long u = 0;
	long t = arr.length.to!long;
	while(arr[i] > v || v > arr[i+1]) {
		if (v < arr[i]) {
			t = i;
			i = min((t + u) / 2, i - 1);
		}
		else {
			u = i;
			i = max((t + u) / 2, i + 1);
		}
	}
	return i;
}

void main() {
	long a, b, q;
	long[] s, t, x;
	scanf("%d %d %d", &a, &b, &q);
	foreach (i;0..a+b+q) {
		long y;
		scanf("%d", &y);
		if (i < a) {
			s ~= y;
		}
		else if (i < a + b) {
			t ~= y;
		}
		else {
			x ~= y;
		}
	}
	s.sort!"a<b";
	t.sort!"a<b";
	s = -long.min/2 ~ s ~ long.max/2;
	t = -long.min/2 ~ t ~ long.max/2;
	foreach(x_;x) {
		auto sc = s.binsearch(x_);
		auto tc = t.binsearch(x_);
		writeln([
				x_ - min(s[sc], t[tc]),
				max(s[sc+1], t[tc+1]) - x_,
				(t[tc+1] - x_) * 2 + (x_ - s[sc]) * 1,
				(t[tc+1] - x_) * 1 + (x_ - s[sc]) * 2,
		].reduce!((a, b) => min(a,b)));
	}
}
