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