// Arup Guha
// 7/4/2013
// Solution to 2013 World Finals Problem D: Factors
/*** Updated on 6/2/2017 to be much faster - key idea was to avoid recalculating multinomial combinations AND the number itself,
     I now pass these in and build them by multiplying in one term at a time from the previous term. ***/

// The key idea here is that given the prime factorization of a number 2^p1*3^p2...
// The number of ordering of factors is (p1+p2+...+pk)!/(p1!p2!...pk!)
// Given the bounds of the problem, we only need to search for sums of the pi's upto 62.
// It's useful to use BigInteger so that we don't have to worry about overflow, and we can
// store useful values (powers of the first 15 primes and the factorials to 62...) in a table.
// Then, we run brute force, trying all combinations of values for the exponents, cutting off
// our search when the numbers get too big. We then store our answers in a HashMap and can
// answer each query when posed quickly.

import java.util.*;
import java.math.*;

public class factors {

	public static int[] primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
	public static HashMap<Long,Long> map;
	public static BigInteger[][] powers;
	public static BigInteger[][] combo;

	public static void main(String[] args) {

		combo = new BigInteger[64][64];
		for (int i=0; i<64; i++) {
			combo[i][0] = new BigInteger("1");
			combo[i][i] = new BigInteger("1");
		}
		for (int i=2; i<64; i++)
			for (int j=1; j<i; j++)
				combo[i][j] = combo[i-1][j-1].add(combo[i-1][j]);

		powers = new BigInteger[primes.length][64];

		// Power table.
		for (int i=0; i<powers.length; i++) {
			powers[i][0] = new BigInteger("1");
			BigInteger prod = new BigInteger(""+primes[i]);
			for (int j=1; j<powers[i].length; j++)
				powers[i][j] = powers[i][j-1].multiply(prod);
		}

		// Build all answers.
		map = new HashMap<Long,Long>();
		for (int i=1; i<=62; i++)
			f(i,0,new BigInteger("1"), new BigInteger("1"), i, 0);

		// Process all cases.
		Scanner stdin = new Scanner(System.in);
		while (stdin.hasNext()) {
			long val = stdin.nextLong();
			System.out.println(val+" "+map.get(val));
		}

	}

	public static void f(int sum, int cursum, BigInteger number, BigInteger perm, int max, int k) {

		// Place in memo table.
		if (cursum > sum) return;
		if (k > primes.length) return;

		// This list is done, evaluate it!
		if (sum == cursum) {

			// No need to store.
			if (tooBig(number)|| tooBig(perm)) return;

			// New value, so add!
			if (!map.containsKey(perm.longValue())) {
				map.put(perm.longValue(), number.longValue());
			}

			// Smaller number, so replace.
			else if (number.longValue() < map.get(perm.longValue())) {
				map.put(perm.longValue(), number.longValue());
			}
			return;
		}

		// We did this list before, so we can stop.
		else if (k == primes.length)
			return;

		// Just go in order here.
		for (int last=1; last<=max; last++) {

			BigInteger newNum = number.multiply(powers[k][last]);

			// We can safely cut out here, since anything that builds on this will get even bigger.
			if (tooBig(newNum)) break;

			// Process this recursive case!
			f(sum, cursum+last, newNum, perm.multiply(combo[cursum+last][last]), last, k+1);
		}
	}

	// Helps us cut out of our searches.
	public static boolean tooBig(BigInteger b) {
		return b.compareTo(powers[0][63]) >= 0;
	}

}