
const val MAX = 20000000000

fun main(args: Array<String>) {
    val (a, b, q) = readLine()!!.split(" ").map { it.toLong() }
    val s = mutableListOf<Long>()
    val t = mutableListOf<Long>()
    val x = mutableListOf<Long>()
    for (i in 0 until a) {
        s.add(readLine()!!.toLong())
    }
    for (i in 0 until b) {
        t.add(readLine()!!.toLong())
    }
    for (i in 0 until q) {
        x.add(readLine()!!.toLong())
    }

    s.add(MAX)
    s.add(0, -1 * MAX)
    t.add(MAX)
    t.add(0, -1 * MAX)

    for (pos in x) {
        val sNeighbors = getNeighbors(s, pos)
        val tNeighbors = getNeighbors(t, pos)
        var cost = MAX

        for (shrine in sNeighbors) {
            for (temple in tNeighbors) {
                val costTmp1 = Math.abs(shrine - pos) + Math.abs(temple - shrine)
                val costTmp2 = Math.abs(temple - pos) + Math.abs(shrine - temple)
                if (Math.min(costTmp1, costTmp2) < cost) cost = Math.min(costTmp1, costTmp2)
            }
        }

        println(cost)
    }
}

fun getNeighbors(points: MutableList<Long>, pos: Long): MutableList<Long> {
    val neighbors = mutableListOf<Long>()
    val rightIndex = points.binarySearch(pos) * -1 - 1
    val leftIndex = points.binarySearch(pos) * -1 - 2
    neighbors.addAll(listOf(points[leftIndex], points[rightIndex]))

    return neighbors
}