#include <iostream>
using namespace std;
int main()
{
long n; //=6420
int d, b[10], e[10], i, m=0;
cout << " n = ? ";
cin >> n; cout << endl;
d=2;
while(n!=1){
if(n%d==0){
m++;
b[m]=d;
e[m]=0;
while(n%d==0){
n=n/d;
e[m]++;
}
}
else d++;
}
for(i=1; i<=m; i++)
cout << " " << b[i]<<" ";
cout << endl;
for(i=1; i<=m; i++)
cout << " " << e[i] <<" ";
cout << endl << endl;
for(i=1; i<=m; i++)
cout << " " <<b[i]<<"^"<<e[i]<<" * ";
cout << endl;
return 0;
}