#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    int a,b,q,i,j;
    cin >> a >> b >> q;
    vector<long long> s(a);
    vector<long long> t(b);
    vector<long long> x(q);
    for(i = 0;i < a;++i){
        cin >> s.at(i);
    }
    for(i = 0;i < b;++i){
        cin >> t.at(i);
    }
    for(i = 0;i < q;++i){
        cin >> x.at(i);
    }
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    int temps,tempt;
    for(i = 0;i < q;++i){
        temps = lower_bound(s.begin(),s.end(),x.at(i))-s.begin();
        tempt = lower_bound(t.begin(),t.end(),x.at(i))-t.begin();
        long long ans = 0;
        if(temps == 0 && tempt == 0){
            ans = max(s.at(0),t.at(0)) - x.at(i);
        }else if(temps == 0 && tempt == b){
            ans = min(s.at(0)-x.at(i),x.at(i)-t.at(b-1))*2+max(s.at(0)-x.at(i),x.at(i)-t.at(b-1));
        }else if(temps == 0){
            ans = min(min(s.at(0)-x.at(i),x.at(i)-t.at(tempt-1))*2+max(s.at(0)-x.at(i),x.at(i)-t.at(tempt-1)),max(s.at(0),t.at(tempt))-x.at(i));
        }else if(temps == a && tempt == 0){
            ans = min(t.at(0)-x.at(i),x.at(i)-s.at(a-1))*2+max(t.at(0)-x.at(i),x.at(i)-s.at(a-1));
        }else if(temps == a && tempt == b){
            ans = x.at(i) - min(s.at(a-1),t.at(b-1));
        }else if(temps == a){
            ans = min(min(t.at(tempt)-x.at(i),x.at(i)-s.at(a-1))*2+max(t.at(tempt)-x.at(i),x.at(i)-s.at(a-1)),x.at(i)-min(t.at(tempt-1),s.at(a-1)));
        }else if(tempt == 0){
            ans = min(min(t.at(0)-x.at(i),x.at(i)-s.at(temps-1))*2+max(t.at(0)-x.at(i),x.at(i)-s.at(temps-1)),max(t.at(0),s.at(temps))-x.at(i));
        }else if(tempt == b){
            ans = min(min(s.at(temps)-x.at(i),x.at(i)-t.at(b-1))*2+max(s.at(temps)-x.at(i),x.at(i)-t.at(b-1)),x.at(i)-min(s.at(temps-1),t.at(b-1)));
        }else{
            if(t.at(tempt-1) < s.at(temps-1)){
                if(t.at(tempt) < s.at(temps)){
                    long long temp1[3];
                    temp1[0] = x.at(i)-t.at(tempt-1);
                    temp1[1] = s.at(temps) -x.at(i);
                    temp1[2] = min(t.at(tempt)-x.at(i),x.at(i)-s.at(temps-1))*2+max(t.at(tempt)-x.at(i),x.at(i)-s.at(temps-1));
                    ans = temp1[0];
                    for(j = 1;j < 3;++j){
                        if(ans > temp1[j]){
                            ans = temp1[j];
                        }
                    }
                }else{
                    ans = min(t.at(tempt)-x.at(i),x.at(i)-t.at(tempt-1));
                }
            }else{
                if(t.at(tempt) < s.at(temps)){
                    ans = min(s.at(temps)-x.at(i),x.at(i)-s.at(temps-1));
                }else{
                    long long temp2[3];
                    temp2[0] = x.at(i)-s.at(temps-1);
                    temp2[1] = t.at(tempt) -x.at(i);
                    temp2[2] = min(s.at(temps)-x.at(i),x.at(i)-t.at(tempt-1))*2+max(s.at(temps)-x.at(i),x.at(i)-t.at(tempt-1));
                    ans = temp2[0];
                    for(j = 1;j < 3;++j){
                        if(ans > temp2[j]){
                            ans = temp2[j];
                        }
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3712