require 'prime' n = gets.to_i if n == 1 puts "1 1" end if Prime.prime?(n) puts "1 #{n}" return end Prime.each(n) {|p| if n % p == 0 puts "#{p} #{n / p}" return end }