#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

template<typename T>
struct Compress{
    vector<T> xs;
    Compress() = default;
    Compress(const vector<T> &vs){
        add(vs);
    }
    Compress(const initializer_list<vector<T>> &vs){
        for(auto &p : vs)   add(p);
    }

    // vs内の座標をすべて追加
    void add(const vector<T> &vs){
        copy(begin(vs), end(vs), back_inserter(xs));
    }

    void add(const T &x){
        xs.emplace_back(x);
    }
    
    void build(){
        sort(begin(xs), end(xs));
        xs.erase(unique(begin(xs), end(xs)), end(xs));
    }

    // vs内の座標を座標圧縮したものを返す
    vector<int> get(const vector<T> &vs) const{
        vector<int> ret;
        transform(begin(vs), end(vs), back_inserter(ret), [&](const T &x){
            return lower_bound(begin(xs), end(xs), x) - begin(xs);
        });
        return ret;
    }

    // 座標xを座標圧縮したものを返す (x が xs 内で何番目にあるかを返す)
    int get(const T &x) const{
        return lower_bound(begin(xs), end(xs), x) - begin(xs);
    }

    // 座標圧縮後のkが示す実際の座標を返す
    const T &operator[](int k) const{
        return xs[k];
    }
};

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }

    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a), t(b), x(q);
    Compress<ll> compress;
    for(int i = 0; i < a; ++i)  cin >> s[i];
    for(int i = 0; i < b; ++i)  cin >> t[i];
    for(int i = 0; i < q; ++i)  cin >> x[i];
    compress.add(s);
    compress.add(t);
    compress.add(x);
    compress.build();
    SegmentTree<int> s_seg(a+b+q, [](int A, int B){return A + B;}, 0);
    SegmentTree<int> t_seg(a+b+q, [](int A, int B){return A + B;}, 0);
    // SegmentTree<int> x_seg(a+b+q, [](int A, int B){return A + B;}, 0);
    for(int i = 0; i < a; ++i){
        int pos = compress.get(s[i]);
        s_seg.update(pos, 1);
    }
    for(int i = 0; i < b; ++i){
        int pos = compress.get(t[i]);
        t_seg.update(pos, 1);
    }
    // for(int i = 0; i < q; ++i){
    //     int pos = compress.get(x[i]);
    //     x_seg.update(pos, 1);
    // }

    for(int i = 0; i < q; ++i){
        ll res = 1e+12;
        int border = compress.get(x[i]);
        int s_left_cnt = s_seg.query(0, border);
        int s_right_cnt = s_seg.query(border, a + b + q);
        int t_left_cnt = t_seg.query(0, border);
        int t_right_cnt = t_seg.query(border, a + b + q);

        if(s_left_cnt > 0 && t_left_cnt > 0){
            int lb = 0, ub = border;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(s_seg.query(0, mid) >= s_left_cnt)   ub = mid;
                else    lb = mid;
            }
            ll s_pos = compress[lb];

            lb = 0, ub = border;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(t_seg.query(0, mid) >= t_left_cnt)   ub = mid;
                else    lb = mid;
            }
            ll t_pos = compress[lb];
            
            ll hoge = max(abs(s_pos - x[i]), abs(t_pos - x[i]));
            chmin(res, hoge);
        }

        if(s_right_cnt > 0 && t_right_cnt > 0){
            int lb = border + 1, ub = a + b + q;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(s_seg.query(border + 1, mid) >= 1)   ub = mid;
                else    lb = mid;
            }
            ll s_pos = compress[lb];

            lb = border + 1, ub = a + b + q;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(t_seg.query(border + 1, mid) >= 1)   ub = mid;
                else    lb = mid;
            }
            ll t_pos = compress[lb];

            ll hoge = max(abs(s_pos - x[i]), abs(t_pos - x[i]));
            chmin(res, hoge);
        }
        
        if(s_left_cnt > 0 && t_right_cnt > 0){
            int lb = 0, ub = border;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(s_seg.query(0, mid) >= s_left_cnt)   ub = mid;
                else    lb = mid;
            }
            ll s_pos = compress[lb];

            lb = border + 1, ub = a + b + q;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(t_seg.query(border + 1, mid) >= 1)   ub = mid;
                else    lb = mid;
            }
            ll t_pos = compress[lb];

            ll foo = abs(s_pos - x[i]);
            ll bar = abs(t_pos - x[i]);
            if(foo > bar)   swap(foo, bar);
            chmin(res, foo * 2 + bar);
        }
        
        if(t_left_cnt > 0 && s_right_cnt > 0){
            int lb = 0, ub = border;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(t_seg.query(0, mid) >= t_left_cnt)   ub = mid;
                else    lb = mid;
            }
            ll t_pos = compress[lb];

            lb = border + 1, ub = a + b + q;
            while(ub - lb > 1){
                int mid = (lb + ub) / 2;
                if(s_seg.query(border + 1, mid) >= 1)   ub = mid;
                else    lb = mid;
            }
            ll s_pos = compress[lb];

            ll foo = abs(s_pos - x[i]);
            ll bar = abs(t_pos - x[i]);
            if(foo > bar)   swap(foo, bar);
            chmin(res, foo * 2 + bar);
        }

        cout << res << "\n";
    }
}

Measured memory_bytes: 15468