#include <bits/stdc++.h>
#define inc(l,i,r) for (int i=l;i<=r;i++)
#define dec(r,i,l) for (int i=r;i>=l;i--)
#define SIZE(V) ((int) V.size())
#define pb push_back
#define fi first
#define se second
// #define mp make_pair
#define ___ putchar(10);
#define cnt(x) __builtin_popcount(x)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int N = 100100, P = 998244353;

int n, tot, d[N], b[N], pri[N];

int main() {
    scanf("%d",&n);
    d[1] = 1;
    for (int i=2;i<=n;i++) {
        if (!b[i]) {
            pri[++tot] = i;
            d[i] = 2;
        }
        for (int j=1;j<=tot && i*pri[j] <= n;j++) {
            b[i*pri[j]] = 1;
            d[i*pri[j]] = d[i] + 1;
            if (i % pri[j] == 0) break;
        }
    }

    // inc(1,i,n) {
    //     printf("%d |\t%d\t%d\t%d\n",i,mp[i],cnt[i],d[i]);
    // }
    inc(1,i,n) printf("%d ",d[i]);
}
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll n;
    cin>>n;
    ll s=3,t;
    repi(a,1,38){
        t=5;
        repi(b,1,26){
            if(s+t>n) break;
            if(s+t==n){
                cout<<a<<" "<<b;
                return 0;
            }
            t*=5;
        }
        s*=3;
    }
    cout<<-1;
}