#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, m, q; cin >> n >> m >> q;
    multiset<ll> S, T, SS, TT;
    for (int i = 0; i < n; i++) {
        ll x; cin >> x;
        S.insert(x);
        TT.insert(x);
    }
    for (int i = 0; i < m; i++) {
        ll x; cin >> x;
        T.insert(x);
        SS.insert(x);
    }
    const ll inf = (ll) 1e16;
    for (int i = 0; i < q; i++) {
        ll x; cin >> x;
        ll res = inf;
        ll firstToLeft = inf, firstToRight = inf;
        auto it = S.lower_bound(x);
        if (it != S.end()) {
            firstToRight = (*it);
        }
        if (it != S.begin()) {
            it--;
            firstToLeft = (*it);
        }
        bool left = true;
        for (ll y : {firstToLeft, firstToRight}) {
            if (y == inf) {
                left ^= 1;
                continue;
            }
            ll dist = abs(x - y);
            it = T.lower_bound(y);
            if (it != T.end()) {
                ll pos = (*it);
                if (left) {
                    if (pos <= x) {
                        res = min(res, dist);
                    } else {
                        res = min(res, dist + abs(y - pos));
                    }
                } else {
                    res = min(res, abs(x - pos));
                }
            }
            if (it != T.begin()) {
                it--;
                ll pos = (*it);
                if (left) {
                    res = min(res, abs(pos - x));
                } else {
                    if (pos >= x) {
                        res = min(res, dist);
                    } else {
                        res = min(res, dist + abs(y - pos));
                    }
                }
            }
            left ^= 1;
        }

        firstToLeft = inf, firstToRight = inf;
        it = SS.lower_bound(x);
        if (it != SS.end()) {
            firstToRight = (*it);
        }
        if (it != SS.begin()) {
            it--;
            firstToLeft = (*it);
        }
        left = true;
        for (ll y : {firstToLeft, firstToRight}) {
            if (y == inf) {
                left ^= 1;
                continue;
            }
            ll dist = abs(x - y);
            it = TT.lower_bound(y);
            if (it != TT.end()) {
                ll pos = (*it);
                if (left) {
                    if (pos <= x) {
                        res = min(res, dist);
                    } else {
                        res = min(res, dist + abs(y - pos));
                    }
                } else {
                    res = min(res, abs(x - pos));
                }
            }
            if (it != TT.begin()) {
                it--;
                ll pos = (*it);
                if (left) {
                    res = min(res, abs(pos - x));
                } else {
                    if (pos >= x) {
                        res = min(res, dist);
                    } else {
                        res = min(res, dist + abs(y - pos));
                    }
                }
            }
            left ^= 1;
        }
        cout << res << "\n";
    }
}


Measured memory_bytes: 20096