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

int binsearch(int[] arr, int v) {
	int i = arr.length.to!int / 2;
	int u = 0;
	int t = arr.length.to!int;
	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() {
	int a, b, q;
	int[] s, t, x;
	scanf("%d %d %d", &a, &b, &q);
	foreach (i;0..a+b+q) {
		int 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 = -int.min/2 ~ s ~ int.max/2;
	t = -int.min/2 ~ t ~ int.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)));
	}
}
