#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin>>n;
	
	unordered_map<int,int> mpp;
	
	while(n%2==0){
		mpp[2]++;
		n=n/2;
	}
	
	for(int i=3;i<=sqrt(n);i=i+2){
		while(n%i==0){
			mpp[i]++;
			n=n/i;
			
		}
	}
	
	if(n>2){
		mpp[n]++;
		
	}
	
	 for(auto it : mpp) {
        cout << it.first << "^" << it.second << " ";
    }

    
	return 0;
}