# frozen_string_literal: true def solve l = ((2..Math.sqrt(M).floor).find { |i| (M % i).zero? } || 1) [l, M / l].join(' ') end M = gets.to_i puts solve