from collections import defaultdict, deque, Counter # from functools import cache # import copy from itertools import combinations, permutations, product, accumulate, groupby, chain # from more_itertools import distinct_permutations from heapq import heapify, heappop, heappush import math import bisect # from pprint import pprint from random import randint, shuffle, randrange # from sortedcontainers import SortedSet, SortedList, SortedDict import sys # sys.setrecursionlimit(2000000) input = lambda: sys.stdin.readline().rstrip('\n') inf = float('inf') mod1 = 10**9+7 mod2 = 998244353 def ceil_div(x, y): return -(-x//y) ################################################# # https://github.com/shakayami/ACL-for-python/blob/master/prime_fact.py from math import gcd import random from collections import Counter def is_probable_prime(n): if n==2: return True if n==1 or n&1==0: return False d=(n-1)>>1 while d&1==0: d>>=1 for k in range(100): a=random.randint(1,n-1) t=d y=pow(a, t, n) while t!=n-1 and y!=1 and y!=n-1: y=(y*y)%n t<<=1 if y!=n-1 and t&1==0: return False return True def _solve(N): if is_probable_prime(N): return N while(True): x=random.randrange(N) c=random.randrange(N) y=(x*x+c)%N d=1 while(d==1): d=gcd(x-y,N) x=(x*x+c)%N y=(y*y+c)%N y=(y*y+c)%N if 11): if N%p==0: while(N%p==0): res[p]+=1 N//=p p+=1 while(N>1): p=_solve(N) while(N%p)==0: res[p]+=1 N//=p return res X = int(input()) if X == 1: print(2) print(1, 2) print("b", "g") exit() pf = prime_fact(X) n = 0 ans_e = [] ans_c = [] for p, e in pf.items(): if p == 2: if e%2 == 1: pn = n n += (p+1) if n > 2*10**5: print(-1) exit() ans_c.extend(["g"]*2) ans_c.append("b") if ans_e: ans_e.append((pn, pn+p+1)) for i in range(pn+1, pn+p+1): ans_e.append((i, pn+p+1)) p = 4 e //= 2 pn = n n += (p+1)*e if n > 2*10**5: print(-1) exit() for _ in range(e): ans_c.extend(["g"]*p) ans_c.append("b") if ans_e: ans_e.append((pn, pn+p+1)) for i in range(pn+1, pn+p+1): ans_e.append((i, pn+p+1)) pn += p+1 print(n) for u, v in ans_e: print(u, v) print(*ans_c)