#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll x;
    cin>>x;
    vector<ll> now;
    ll cnt = 0;
    for(int i = 2;i<=(int)2e5;i++){
        while(x%i==0){
            if(i==2){
                cnt++;
                x /= i;
                continue;
            }
            now.push_back(i);
            x /= i;
        }
    }
    if(x!=1) now.push_back(x);
    if(now.empty()){
        now.push_back(x);
    }
    while(cnt>0){
        if(cnt>=2){
            now.push_back(4);
            cnt -= 2;
        }else{
            now.push_back(2);
            break;
        }
    }
    ll sum = 0;
    for(int i = 0;i<now.size();i++) sum += now[i];
    sum += now.size();
    if(sum>(int)2e5){
        cout<<-1<<endl;
        return 0;
    }
    vector<int> u,v;
    int nxt = 0;
    int prev = -1;
    vector<char> ans;
    for(int i = 0;i<now.size();i++){
        if(prev!=-1){
            u.push_back(nxt);
            v.push_back(prev);
        }
        prev = nxt;
        nxt++;
        ans.push_back('b');
        for(int j = 0;j<now[i];j++){
            u.push_back(prev);
            v.push_back(nxt);
            nxt++;
            ans.push_back('g');
        }
    }
    cout<<ans.size()<<endl;
    for(int i = 0;i<u.size();i++){
        cout<<u[i]+1<<" "<<v[i]+1<<endl;
    }
    for(int i = 0;i<ans.size();i++){
        if(i) cout<<" ";
        cout<<ans[i];
    }
    cout<<endl;
    
}