l, d = gets.split.map(&:to_i) if d > 2 puts ['matsu', 'kado'][((l - 1) / 5) % 2] else if d == 1 puts 'matsu' else if l % 3 == 0 c = 0 while l > 3 x = (l - 3) / 3 if x % 3 == 0 l = x else l = x + 3 - x % 3 end c += 1 end puts ['matsu', 'kado'][c % 2] else puts 'matsu' end end end