#include<stdio.h> #include<string.h> #include<vector> #define N 65536 using namespace std; int prime[N]; bool visit[N]; struct node { int x,y; } cpt; vector<node>v; int num=0; int prim() { memset(visit,true,sizeof(visit)); for(int i=2; i<=N; i++) { if(visit[i]==true) { num++; prime[num]=i; } for(int j=1; j<=num&&i*prime[j]<=N; j++) { visit[i*prime[j]]=false; if(i%prime[j]==0)break; } } return 0; } int main() { int n; prim(); int _case=0; while(scanf("%d",&n)!=EOF&&n>0) { v.clear(); for(int i=1; i<num&&n>=prime[i]; i++) { if(n%prime[i]==0) { cpt.x=prime[i]; cpt.y=1; n/=prime[i]; while(n%prime[i]==0) { cpt.y++; n/=prime[i]; } v.push_back(cpt); } } if(_case>0) printf("\n");//!!!!!!!!!! printf("Case %d.\n",++_case); printf("%d %d ",v[0].x,v[0].y); for(int i=1;i<v.size();i++) printf("%d %d ",v[i].x,v[i].y);//!!!!!!!!!! printf("\n"); } return 0; }