// import scala.io.{StdIn => in}
import java.io._
import scala.collection.{mutable => mu}
import scala.annotation.tailrec

object Main extends App {
  val INF = 2L << 40
  val in = new BufferedReader(new InputStreamReader(System.in))
  val Array(a, b, q) = in.readLine.split(" ").map(_.toInt)
  val s = Iterator.continually(in.readLine.toLong)
    .take(a)
    .to[mu.ArrayBuffer]
  -INF +=: s
  s += INF

  val t = Iterator.continually(in.readLine.toLong)
    .take(b)
    .to[mu.ArrayBuffer]
  -INF +=: t
  t += INF

  val out = new java.io.PrintWriter(System.out)
  Iterator.continually(in.readLine.toLong)
    .take(q)
    .foreach(x => {
      var dist = Long.MaxValue
      for {
        k <- 0 until 2
        arrA = if(k == 0) s else t
        arrB = if(k == 0) t else s
        i <- 0 until 2
        posA = math.min(binarySearch(arrA, x) + i, arrA.size-1)
        ax = arrA(posA)
        j <- 0 until 2
        posB = math.min(binarySearch(arrB, ax) + j, arrB.size-1)
        bx = arrB(posB)
      } {
        val a = ( x - ax).abs
        val b = (ax - bx).abs
        dist = math.min(dist, a + b)
      }
      out.println(dist)
    })
  out.flush

  def binarySearch(arr:mu.ArrayBuffer[Long], x:Long):Int = {
    var left = 0
    var right = arr.size

    @tailrec
    def loop(left:Int, right:Int):Int = {
      if(right - left < 2) left
      else {
        val mid = (left + right) / 2
        if(arr(mid) <= x) loop(mid,right)
        else loop(left, mid)
      }
    }
    loop(left, right)
  }
}