fun main(args:Array<String>?): Unit {
    val q = readLine()!!.trim().toInt()
    repeat(q){
        val (c, a, n) = readLine()!!.trim().split(' ').map(String::toInt)
        val third = listOf(c, a, n).min()!!
        val first = listOf((c - third) / 2, a - third).min()!!
        val second = (c - third - first * 2) / 3
        println(first + second + third)
    }
}
