#include <bits/stdc++.h>
using namespace std;

void executeTime() {
    cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " secs";
}

int main() {

    int n; cin >> n;

    map<int, int> mp;

    while (n % 2 == 0) {
        mp[2]++;
        n >>= 1;
    }

    for (int i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            mp[i] ++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    for (auto &x : mp) {
        cout << x.first << ' ' << x.second << endl;
    }




    executeTime();
    return 0;
}