#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;

int main(void) {
    lint a, b, q;
    cin >> a >> b >> q;
    vector<lint> shrine(a), temple(b), query(q);
    repeat (i, a) cin >> shrine[i];
    repeat (i, b) cin >> temple[i];
    repeat (i, q) cin >> query[i];
    sort(shrine.begin(), shrine.end());
    sort(temple.begin(), temple.end());
    
    auto lr = [](const vector<lint>& v, lint x) -> pll { //left right
        lint left, right;
        auto it = lower_bound(v.begin(), v.end(), x);
        if (it == v.begin()) {
            left = -1;
            right = *it;
        }
        else if (it == v.end()) {
            left = *(it - 1);
            right = -1;
        }
        else {
            left = *(it - 1); 
            right = *it;
        }
        return make_pair(left, right);
    };
    
    repeat (i, q) {
        lint ans = 1e18;
        lint x = query[i];
        // first shrine
        {   // left shrine -> left temple
            auto s = lr(shrine, x).fst;
            auto t = lr(temple, s).fst;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-s) + abs(s-t));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        {   // left shrine -> right temple
            auto s = lr(shrine, x).fst;
            auto t = lr(temple, s).snd;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-s) + abs(s-t));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        {   // right shrine -> left temple
            auto s = lr(shrine, x).snd;
            auto t = lr(temple, s).fst;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-s) + abs(s-t));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        {   // right shrine -> right temple
            auto s = lr(shrine, x).snd;
            auto t = lr(temple, s).snd;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-s) + abs(s-t));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        // first temple
        {   // left temple -> left shrine
            auto t = lr(temple, x).fst;
            auto s = lr(shrine, t).fst;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-t) + abs(t-s));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        {   // left temple -> right shrine
            auto t = lr(temple, x).fst;
            auto s = lr(shrine, t).snd;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-t) + abs(t-s));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        {   // right temple -> left shrine
            auto t = lr(temple, x).snd;
            auto s = lr(shrine, t).fst;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-t) + abs(t-s));  //dump(x); dump(s); dump(t); el;
            }
        }
        
        {   // right temple -> right shrine
            auto t = lr(temple, x).snd;
            auto s = lr(shrine, t).snd;
            if (s != -1 and t != -1) {
                ans = min(ans, abs(x-t) + abs(t-s));  //dump(x); dump(s); dump(t); el;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3712