#include <iostream>
#include <vector>
#include <algorithm>

#define all(v) (v).begin(), (v).end()
using namespace std;

typedef long long LL;

struct Query
{
    int index;
    LL position;

    Query(LL p, int i)
    {
        position = p, index = i;
    }

    int operator <(const Query &Q)
    {
        return (position < Q.position);
    }
};

int main()
{
    int no_of_temples, no_of_shrines, no_of_queries;
    cin >> no_of_temples >> no_of_shrines >> no_of_queries;

    vector <LL> temple(no_of_temples + 1, 0);
    for(int i = 1; i <= no_of_temples; i++)
        cin >> temple[i];

    sort(all(temple));

    vector <LL> shrine(no_of_shrines + 1, 0);
    for(int i = 1; i <= no_of_shrines; i++)
        cin >> shrine[i];

    sort(all(shrine));

    vector <Query> query(no_of_queries + 1, Query(0, 0));
    for(int i = 1; i <= no_of_queries; i++)
    {
        LL position;
        cin >> position;

        query[i] = Query(position, i);
    }

    sort(all(query));

    const LL oo = 1e18;

    vector <LL> right_most_temple(no_of_queries + 1, oo);
    vector <LL> right_most_shrine(no_of_queries + 1, oo);
    int right_temple = no_of_temples, right_shrine = no_of_shrines;

    for(int current_query = no_of_queries; current_query >= 1 ;current_query--)
    {
        while(temple[right_temple - 1] >= query[current_query].position)
            right_temple--;

        while(shrine[right_shrine - 1] >= query[current_query].position)
            right_shrine--;

        if(query[current_query].position <= temple[right_temple]) right_most_temple[current_query] = temple[right_temple];
        if(query[current_query].position <= shrine[right_shrine]) right_most_shrine[current_query] = shrine[right_shrine];
    }

    vector <LL> left_most_temple(no_of_queries + 1, -oo);
    vector <LL> left_most_shrine(no_of_queries + 1, -oo);
    int left_temple = 1, left_shrine = 1;

    for(int current_query = 1; current_query <= no_of_queries; current_query++)
    {
        while(left_temple + 1 <= no_of_temples && temple[left_temple + 1] <= query[current_query].position)
            left_temple++;

        while(left_shrine + 1 <= no_of_shrines && shrine[left_shrine + 1] <= query[current_query].position)
            left_shrine++;

        if(temple[left_temple] <= query[current_query].position) left_most_temple[current_query] = temple[left_temple];
        if(shrine[left_shrine] <= query[current_query].position) left_most_shrine[current_query] = shrine[left_shrine];
    }

    /*for(int i = 1; i <= no_of_queries; i++)
    {
        cout << "At " << query[i].position << endl;
        cout << "Left most temple = " << left_most_temple[i] << " Left most shrine = " << left_most_shrine[i] << endl;
        cout << "Right most temple = " << right_most_temple[i] << " Right most shrine = " << right_most_shrine[i] << endl;
    }*/

    vector <LL> answer(no_of_queries + 1, 0);
    for(int i = 1; i <= no_of_queries; i++)
    {   //cout << "For " << query[i].position << endl;
        LL going_only_right = max(right_most_temple[i], right_most_shrine[i]) - query[i].position;
        LL going_only_left = query[i].position - min(left_most_temple[i], left_most_shrine[i]);

        LL one_way = min(going_only_left, going_only_right);

        LL right_first_then_left = min(2*(right_most_temple[i] - query[i].position) + query[i].position - left_most_shrine[i],
                                       2*(right_most_shrine[i] - query[i].position) + query[i].position - left_most_temple[i]);
        LL left_first_then_right = min(2*(query[i].position - left_most_temple[i]) + right_most_shrine[i] - query[i].position,
                                       2*(query[i].position - left_most_shrine[i]) + right_most_temple[i] - query[i].position);

        LL two_way = min(right_first_then_left, left_first_then_right); //cout << "One Way = " << one_way << " Two Way = " << two_way << endl;

        answer[query[i].index] = min(one_way, two_way);
    }

    for(int i = 1; i <= no_of_queries; i++)
        cout << answer[i] << "\n";

    return 0;
}


Measured memory_bytes: 8320