#include <bits/stdc++.h>
using namespace std;
using Int = long long;
template <class T> inline bool setmin(T &A, T B){
	if (A > B){
		A = B;
		return true;
	} else {
		return false;
	}
}
template <class T> inline bool setmax(T &A, T B){
	if (A < B){
		A = B;
		return true;
	} else {
		return false;
	}
}
#define REP(x, y) for (int x = 0; x < int(y); ++x)
#define rep(x, y, z) for (int x = int(y); x < int(z); ++x)
#define PER(x, y) for (int x = int(y) - 1; x >= 0; --x)
#define per(x, y, z) for (int x = int(z) - 1; x >= int(y); --x)

void solve(){
	int N, KA, KB;
	cin >> N >> KA >> KB;
	vector<int> a(KA);
	REP(i, KA){
		cin >> a[i];
	}
	vector<int> b(KB);
	REP(i, KB){
		cin >> b[i];
	}
	auto min_dist = [&](vector<int> &arr, int x) -> int{
		auto itr = lower_bound(arr.begin(), arr.end(), x);
		int mn = N;
		if (itr != arr.end()){
			setmin(mn, *itr - x);
		}
		if (itr != arr.begin()){
			setmin(mn, x - *--itr);
		}
		return mn;
	};
	int ab = N;
	REP(i, KA){
		setmin(ab, min_dist(b, a[i]));
	}
	int Q;
	cin >> Q;
	REP(i, Q){
		int s, t;
		cin >> s >> t;
		int ans = t - s;
		setmin(ans, min_dist(a, s) + min_dist(a, t));
		setmin(ans, min_dist(b, s) + min_dist(b, t));
		setmin(ans, min_dist(a, s) + ab + min_dist(b, t));
		setmin(ans, min_dist(b, s) + ab + min_dist(a, t));
		cout << ans << '\n';
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t = 1;
	// cin >> t;
	while (t--){
		solve();
	}
}