#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
const int MAX = 300005;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
int N, M , Q ;
ll parent[MAX] , component_size[MAX] , result[MAX] ;

int findRoot(int node){
	return parent[node] == node ? node : parent[node] = findRoot(parent[node]) ;
}
void UnionNodes(int x , int y){
	int rootX = findRoot(x) ;
	int rootY = findRoot(y) ;
	if(rootX == rootY) return ; 
	if(rand() & 1) swap(rootX , rootY) ;
	parent[rootY] = rootX ;
	component_size[rootX] += component_size[rootY];
    component_size[rootY] = 0;
}
//check modulo
int main(){
	IOS;
	cout.precision(50) ;
	int a ,b ,q ; cin >> a >> b >> q;
	ll x;map<ll , bool> s;for(int i = 0 ; i < a ; i++) {cin >> x ;s[x] = true ;}
	map<ll ,bool> t;for(int i = 0 ; i < b ;i++) {cin >> x ;t[x] = true ;}
	for(int i = 0 ; i < q ; i++){
		cin >> x ;
		map<ll , bool> :: iterator up_s = s.lower_bound(x) ;
		map<ll , bool> :: iterator up_t = t.lower_bound(x) ;
		if(up_s == s.end()){
			up_s-- ;
			if(up_t == t.end()){
				up_t-- ;
				cout << x - min(up_s->x , up_t->x) << "\n" ;
			}
			else if(up_t == t.begin()){
				cout << min(x - up_s->x , up_t->x - x) + up_t->x - up_s->x <<"\n"  ;
			}
			else{
				ll d1 = up_t-> x;
				up_t-- ;
				ll d2= up_t->x ;
				ll ans = min(x - min(d2 , up_s->x) , min(d1 - x , x - up_s -> x) + d1 - up_s->x) ;
				cout << ans << "\n" ;
			}
		}
		else if(up_s == s.begin()){
			if(up_t == t.end()){
				up_t-- ;
				cout << min(x - up_t->x , up_s-> x - x) + up_s->x - up_t->x << "\n" ;
			}
			else if(up_t == t.begin()){
				cout << max(up_s->x , up_t->x) - x << "\n" ;
			}
			else{
				ll d1 = up_t-> x;
				up_t-- ;
				ll d2= up_t->x ;
				ll ans = min(max(up_s->x , d1) - x , min(x - d2 , up_s->x - x) + up_s-> x - d2)  ;
				cout << ans << "\n" ;
			}
		}
		else{
			ll D1 = up_s->x ;
			up_s--;ll D2= up_s->x ;
			if(up_t==t.end()){
				up_t-- ;
				cout << min(x -min(D2 ,up_t->x) , min(D1 - x , x - up_t->x) + D1 - up_t->x) <<"\n" ;
			}
			else if(up_t == t.begin()){
				cout << min(max(D1 , up_t->x) - x , min(x - D2 , up_t->x - x) + up_t->x - D2) <<"\n" ;
			}
			else{
				ll d1 = up_t->x ;
				up_t--;ll d2 = up_t->x ;
				cout << min({max(D1 ,d1) - x , x - min(d2 , D2) , min(x - D2 , d1 - x) + d1 - D2 , min(D1 - x ,x - d2) + D1 - d2}) <<"\n" ;
			}
		}
	} 
					 
	
	return 0;
}


Measured memory_bytes: 13824