import java.util.Collections
import java.math.*

fun main(args: Array<String>) {
    val minusInf = -1000000000000000L
    val plusInf = 1000000000000000L

    val (a, b, q) = readInputLine().split(" ").map{it.toInt()}
    
    val shrines = mutableListOf<Long>()
    for (i in 1..a) {
        shrines.add(readInputLine().toLong())
    }
    
    val temples = mutableListOf<Long>()
    for (i in 1..b) {
        temples.add(readInputLine().toLong())
    }

    for (i in 1..q) {
        val x = readInputLine().toLong()
        
        val rightShrineIndex = lowerBound(shrines, x)
        val rightShrine = if (rightShrineIndex == a) plusInf else shrines[rightShrineIndex]
        val leftShrine = if (rightShrineIndex == 0) minusInf else shrines[rightShrineIndex - 1]
        val rightTempleIndex = lowerBound(temples, x)
        val rightTemple = if (rightTempleIndex == b) plusInf else temples[rightTempleIndex]
        val leftTemple = if (rightTempleIndex == 0) minusInf else temples[rightTempleIndex - 1]

        var distance = Long.MAX_VALUE

        distance = Math.min(distance, Math.abs(x - rightShrine) + Math.abs(rightShrine - rightTemple))
        distance = Math.min(distance, Math.abs(x - rightShrine) + Math.abs(rightShrine - leftTemple))
        distance = Math.min(distance, Math.abs(x - leftShrine) + Math.abs(leftShrine - rightTemple))
        distance = Math.min(distance, Math.abs(x - rightTemple) + Math.abs(rightTemple - rightShrine))
        distance = Math.min(distance, Math.abs(x - leftTemple) + Math.abs(leftTemple - rightShrine))
        distance = Math.min(distance, Math.abs(x - leftShrine) + Math.abs(leftShrine - leftTemple))
        distance = Math.min(distance, Math.abs(x - rightTemple) + Math.abs(rightTemple - leftShrine))
        distance = Math.min(distance, Math.abs(x - leftTemple) + Math.abs(leftTemple - leftShrine))
        
        println(distance)
    }
}

fun readInputLine(): String {
    return readLine()!!
}

fun <T: Comparable<T>> lowerBound(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, {x, y -> if (x >= y) 1 else -1}).inv()
}
