def lscan; gets.split.map(&:to_i); end n, z = lscan if n == 1 if z == 1 puts 'Yes' else puts 'No' end exit end (1..30).each do |x| (1..30).each do |y| if x**n+y**n == z**n puts 'Yes' exit end end end puts 'No'