'use strict'
function Main(input){
  input=input.split(/\s+/);
  for(let i in input)input[i]=parseInt(input[i],10);
//  console.log(input);
  var A=input.shift(),B=input.shift(),Q=input.shift();
  var s=input.splice(0,A),t=input.splice(0,B),x=input;
//  console.log(s,t,x);
  {
    let y=[[-Infinity,-Infinity],[Infinity,Infinity]];
    for(let i in x){
      let X=x[i];
      let d=0,u=y.length;
      let m=Math.floor((d+u)/2);
      while(d<=u){
        let Y=y[m][0];
        if(Y<X)d=m+1;
        else u=m-1;
        m=Math.floor((d+u)/2);
      }
      y.splice(m+1,0,[X,i]);
    }
    y.shift();
    y.pop();
    x=y;
  }
//  console.log(x);
  s.unshift(-Infinity);
  s.push(Infinity);
  t.unshift(-Infinity);
  t.push(Infinity);
  var s_left=[],t_left=[],s_right=[],t_right=[];
  {let j=0,k=0;
    for(let i=0;i<Q;i++){
      let X=x[i][0];
      while(s[j]<X)j++;
      while(t[k]<X)k++;
      s_left[i]=s[j-1];
      s_right[i]=s[j];
      t_left[i]=t[k-1];
      t_right[i]=t[k];
//      console.log([s_left[i],X,s_right[i]],[t_left[i],X,t_right[i]]);
    }
  }
  var ans=[];
  for(let i in x){
    let n=x[i][1];
    let X=x[i][0];
    let sl=s_left[i];
    let tl=t_left[i];
    let sr=s_right[i];
    let tr=t_right[i];
    ans[n]=Math.min(
      l(sr,tr,X),
      l(sr,tl,X),
      l(sl,tr,X),
      l(sl,tl,X),
      l(tr,sr,X),
      l(tr,sl,X),
      l(tl,sr,X),
      l(tl,sl,X)
    ).toString(10);
  }
  console.log(ans.join('\n'));
}

function l(a,b,c){
  var L=Math.abs(b-a)+Math.abs(c-b);
  if(L!==L)return(Infinity);
  return L;
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));