fun main(args : Array<String>) {
    val (A, B, Q) = readLine()!!.split(" ").map { it.toInt() }
    val s = LongArray(A)
    val t = LongArray(B)
    (0 until A).forEach {
        s[it] = readLine()!!.toLong()
    }
    (0 until B).forEach {
        t[it] = readLine()!!.toLong()
    }
    // O(AlogA)
    s.sort()
    // O(BlogB)
    t.sort()

    // O(QlogQ)
    (0 until Q).forEach {
        val x = readLine()!!.toLong()
        val si = lowerBound(s, x)
        val ti = lowerBound(t, x)

        val s1 = s.getOrElse(si - 1, { -50000000001L }) // x未満の最大のs
        val s2 = s.getOrElse(si, { 50000000001L }) // ｘ以上の最小のs
        val t1 = t.getOrElse(ti - 1, { -50000000001L }) // x未満の最大のt
        val t2 = t.getOrElse(ti, { 50000000001L })  // x以上の最小のt
        val answer = listOf(Math.max(x - t1,  x - s1), Math.max(t2 - x, s2 - x), t2 - s1 + Math.min(Math.abs(t2 -x), Math.abs(s1 -x)), s2 - t1 + Math.min(Math.abs(s2-x), Math.abs(t1-x)))
                .min()!!
        println(answer)
    }
}

fun lowerBound(array: LongArray, value: Long): Int {
    var low = 0
    var high = array.size
    while (low < high) {
        val mid = (low + high) / 2
        if (value <= array[mid]) {
            high = mid
        } else {
            low = mid + 1
        }
    }
    return low
}