//#include #include using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; int main() { ll X,Count=0; cin >> X; if(X == 1) { cout << 2 << endl; cout << 1 << " " << 2 << endl; cout << "b g" << endl; return 0; } if(X == 4) { cout << 5 << endl; cout << 1 << " " << 2 << endl; cout << 1 << " " << 3 << endl; cout << 1 << " " << 4 << endl; cout << 1 << " " << 5 << endl; cout << "b g g g g" << endl; return 0; } vector Ans; for(ll i = 2; i <= 200000; i++) { int c = 0; while(X%i == 0) { c++; X/=i; Ans.push_back(i); } Count += (i+1)*c; } if(X != 1 || 200000 < Count) { cout << -1 << endl; return 0; } vector Color(Count+1); cout << Count << endl; int used = 1, save = -1; for(int i = 0; i < Ans.size(); i++) { Color[used] = "b"; for(int j = 1; j <= Ans[i]; j++) { cout << used << " " << used+j << endl; Color[used+j] = "g"; } if(save != -1) cout << save << " " << used << endl; save = used; used += Ans[i]+1; } for(int i = 1; i <= Count; i++) { cout << Color[i] << " "; } cout << endl; return 0; }