import java.util.*

fun main(args: Array<String>) {
    val (A, B, Q) = readLine()!!.split(" ").map {it.toInt()}
    val s = TreeSet<Long>(Array(A) { readLine()!!.toLong() }.toList())
    val t = TreeSet<Long>(Array(B) { readLine()!!.toLong() }.toList())
    val x = Array(Q) { readLine()!!.toLong() }

    val INF = 1e15.toLong()

    for (a in x) {
        val sl = s.floor(a) ?: -INF
        val su = s.ceiling(a) ?: INF
        val tl = t.floor(a) ?: -INF
        val tu = t.ceiling(a) ?: INF

        var res = a - Math.min(sl, tl)
        res = Math.min(res, Math.max(su, tu) - a)
        res = Math.min(res, tu - sl + Math.min(tu - a, a - sl))
        res = Math.min(res, su - tl + Math.min(su - a, a - tl))

        println(res)
    }
}
