using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var x = long.Parse(ReadLine()); var prev = -1; var ans = new List(); var color = new List(); if (x == 1) { color.Add('b'); color.Add('g'); ans.Add(new int[] { 1, 2 }); } { while (x % 4 == 0) { color.Add('b'); var br = color.Count; if (prev > 0) ans.Add(new int[] { prev, br }); for (var j = 0; j < 4; ++j) { color.Add('g'); ans.Add(new int[] { br, color.Count }); } prev = br; x /= 4; } } for (var i = 2; i <= 200000; ++i) { while (x % i == 0) { color.Add('b'); var br = color.Count; if (prev > 0) ans.Add(new int[] { prev, br }); for (var j = 0; j < i; ++j) { color.Add('g'); ans.Add(new int[] { br, color.Count }); } prev = br; x /= i; } } if (x > 1 || ans.Count > 200000) { WriteLine(-1); return; } WriteLine(color.Count); WriteLine(string.Join("\n", ans.Select(ai => string.Join(" ", ai)))); WriteLine(string.Join(" ", color)); } }