$cache = Hash.new class Integer def combination(k) self.factorial/(k.factorial*(self-k).factorial) end def permutation(k) self.factorial/(self-k).factorial end def factorial return 1 if self == 0 return $cache[self] if $cache[self] $cache[self] = (1..self).inject(:*) end end class Yukicoder def initialize q = gets.to_i q.times do d, x, t = gets.chomp.split.map(&:to_i) if (x+d-1).combination(d-1) <= t puts "AC" else puts "ZETUBOU" end end end end Yukicoder.new