q = gets.to_i
q.times do
    a, b, c = gets.split.map(&:to_i)
    n1 = [a, b, c].min
    a -= n1; b -= n1; c -= n1
    n2 = [a / 2, b].min
    a -=  2 * n2; b -= n2;
    n3 = a / 3
    puts n1 + n2 + n3
end