fun main(args: Array<String>) {

    val (A, B, Q) = readLine()!!.split(' ').map { it.toInt() }
    val ss = listOf(-100000000000L, *((0 until A).map { readLine()!!.toLong() }.toTypedArray()), 100000000000L)
    val ts = listOf(-100000000000L, *((0 until B).map { readLine()!!.toLong() }.toTypedArray()), 100000000000L)
    val xs = (0 until Q).map { readLine()!!.toLong() }

    xs.forEach { x ->

        val si = -(ss.binarySearch(x) + 1)
        val ti = -(ts.binarySearch(x) + 1)

        val res = arrayOf(ss[si - 1], ss[si]).map { s ->
            arrayOf(ts[ti - 1], ts[ti]).map { t ->
                val d1 = Math.abs(x - s) + Math.abs(s - t)
                val d2 = Math.abs(x - t) + Math.abs(t - s)
                Math.min(d1, d2)
            }.min()!!
        }.min()!!

        println(res)
    }

}