using System; using System.Collections.Generic; namespace No690 { public class Program { struct Edge { public int From; public int To; public Edge(int from, int to) { From = from; To = to; } } public static void Main(string[] args) { var K = int.Parse(Console.ReadLine()); if (K == 0) { Console.WriteLine("3 1"); Console.WriteLine("1 2"); return; } var v = (int)Math.Ceiling(Math.Log(K, 2)) + 2; var ans = new List(); for (var i = 1; i <= v; i++) for (var j = i + 1; j <= v; j++) { ans.Add(new Edge(i, j)); } for (int i = (1 << (v - 2)) - K, j = 2; i > 0; i >>= 1, j++) { if ((i & 1) == 1) ans.Remove(new Edge(j, v)); } Console.WriteLine($"{v} {ans.Count}"); ans.ForEach(e => Console.WriteLine($"{e.From} {e.To}")); } } }