// Arup Guha
// 2/18/2024
// Solution to Kattis Problem: Primal Representation
// https://open.kattis.com/problems/primalrepresentation

import java.util.*;

public class primalrepresentation {
	
	public static ArrayList<Integer> primes;

	public static void main(String[] args) {
		
		// Do prime sieve to square root of int, roughly.
		boolean[] sieve = new boolean[50000];
		Arrays.fill(sieve, true);
		for (int i=2; i<50000; i++)
			for (int j=2*i; j<50000; j+=i)
				sieve[j] = false;
			
		// Make prime list.
		primes = new ArrayList<Integer>();
		for (int i=2; i<50000; i++)
			if (sieve[i])
				primes.add(i);
	
		Scanner stdin = new Scanner(System.in);
		
		while (stdin.hasNext()) {
			
			// Read in n, mark if negative, then store positive equivalent.
			int n = stdin.nextInt();
			boolean neg = n < 0;
			if (neg) n = -n;
			
			ArrayList<Integer> pfact = primeFact(n);
			
			// Get this out of the way.
			if (neg) System.out.print("-1 ");
			
			// Go through terms.
			for (int i=0; i<pfact.size(); i+=2) {
			
				// This always prints.
				System.out.print(pfact.get(i));
			
				// For powers greater than 1.
				if (pfact.get(i+1) > 1)
					System.out.print("^"+pfact.get(i+1));
					
				// For spacing.
				if (i+2<pfact.size()) System.out.print(" ");
			}
			System.out.println();
		
		}
	}
	
	public static ArrayList<Integer> primeFact(int n) {
	
		ArrayList<Integer> res = new ArrayList<Integer>();
		
		// Go through primes.
		for (int i=0; i<primes.size(); i++) {
		
			// Get out... also avoids overflow error.
			if (primes.get(i)*primes.get(i) > n) break;
		
			// Divide out as many copies of i as possible.
			int exp = 0;
			while (n%primes.get(i) == 0) {
				exp++;
				n /= primes.get(i);
			}
			
			// Add term.
			if (exp > 0) {
				res.add(primes.get(i));
				res.add(exp);
			}
		}
		
		// Last prime...
		if (n > 1) {
			res.add(n);
			res.add(1);
		}
		
		// Ta da!
		return res;
	}
}