#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int n, m, q; cin >> n >> m >> q;
  vector<int> a(n+2), b(m+2);
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }
  for(int i = 1; i <= m; i++){
    cin >> b[i];
  }
  a[0] = b[0] = 0;
  a[n+1] = b[m+1] = 1LL << 60;
  cout << endl;
  cout << a << b << endl;
  for(int i = 0; i < q; i++){
    int x; cin >> x;
    int ans = 1LL << 60;

    int pos_a_r = lower_bound(a.begin(),a.end(),x) - a.begin();
    ans = min(ans, a[pos_a_r] - x + min(*lower_bound(b.begin(),b.end(),a[pos_a_r]) - a[pos_a_r], a[pos_a_r] - *(lower_bound(b.begin(),b.end(),a[pos_a_r])-1)));
    cout << ans << " ";
    int pos_a_l = pos_a_r - 1;
    ans = min(ans, x - a[pos_a_l] + min(*lower_bound(b.begin(),b.end(),a[pos_a_l]) - a[pos_a_l], a[pos_a_l] - *(lower_bound(b.begin(),b.end(),a[pos_a_l-1])-1)));
    cout << ans << " ";
    int pos_b_r = lower_bound(b.begin(),b.end(),x) - b.begin();
    ans = min(ans, b[pos_b_r] - x + min(*lower_bound(a.begin(),a.end(),b[pos_b_r]) - b[pos_b_r], b[pos_b_r] - *(lower_bound(a.begin(),a.end(),b[pos_b_r-1])-1)));
    cout << ans << " ";
    int pos_b_l = pos_b_r - 1;
    ans = min(ans, x - b[pos_b_r] + min(*lower_bound(a.begin(),a.end(),b[pos_b_l]) - b[pos_b_l], b[pos_b_l] - *(lower_bound(a.begin(),a.end(),b[pos_b_l-1])-1)));

    cout << ans << endl;
    cout << x << " " << pos_a_l << " " << pos_a_r << " " << pos_b_l << " " << pos_b_r << endl;
  }
  /*
    とりあえず久しぶりに書いた
    書いたけど違った
    これのデバックはだるすぎる
    コード保存したいから提出する
  */

  return 0;
}
