using System; using System.Collections.Generic; using System.Linq; class Program { internal static void Main() => new Program().Solve(); void Solve() { //code int n = IO.Read(); var linklist = new LinkedList(); for (int i = 1; i <= n; i++) { linklist.AddLast(i); } for (int i = 0; i < n; i++) { IO.WriteEnum(linklist); LinkedListNode node = linklist.First; linklist.RemoveFirst(); linklist.AddLast(node); } } } static class IO { static readonly Queue que = new Queue(); public static T Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return (T)Convert.ChangeType(que.Dequeue(), typeof(T)); } public static IEnumerable ReadEnum(long n) { for (long i = 0; i < n; i++) yield return Read(); } public static void Write(T item) => Console.WriteLine(item); public static void WriteEnum(IEnumerable items, string separetor = " ") => Write(string.Join(separetor, items)); }