using System; using System.Collections.Generic; using System.Linq; namespace Program { public class Solver { Random rnd = new Random(); int n = 100; public void Solve() { int q = int.Parse(Console.ReadLine()); if (q != 5500) throw new Exception(); solve(0, n, new Stack(Enumerate(n, x => x))); var ok = true; ok &= ans.Distinct().Count() == 100; ok &= ans.Min() == 0; ok &= ans.Max() == 99; if (!ok) throw new Exception(); query(ans); } int[] ans = new int[100]; void solve(int l, int r, Stack a) { if (r - l == 1) { ans[l] = a.Pop(); return; } a = new Stack(a.OrderBy(x => rnd.Next())); var L = new Stack(); var R = new Stack(); var m = (l + r) / 2; while (l + L.Count != m && m + R.Count != r) { var p = a.Pop(); var q = a.Pop(); var b = Enumerate(n, x => -1); for (int i = l; i < r; i++) b[i] = i < m ? p : q; var res = query(b); if (res[2] == 0 || res[2] == 2) { if (res[2] == 0) Swap(ref p, ref q); L.Push(p); R.Push(q); } else { b = Enumerate(n, x => -1); for (int i = l; i < m; i++) b[i] = p; res = query(b); if (res[2] == 1) { L.Push(p); L.Push(q); } else { R.Push(p); R.Push(q); } } } while (l + L.Count != m) L.Push(a.Pop()); while (m + R.Count != r) R.Push(a.Pop()); solve(l, m, L); solve(m, r, R); } int[] query(int[] a) { for (int i = 0; i < a.Length; i++) { if (a[i] != -1) Console.Write($"{a[i] / 10}{a[i] % 10}"); else Console.Write($"??"); if (i + 1 != a.Length) Console.Write(" "); else Console.WriteLine(); } Console.Out.Flush(); return Console.ReadLine().Split().Select(int.Parse).ToArray(); } static T[] Enumerate(int n, Func f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; } static public void Swap(ref T a, ref T b) { var tmp = a; a = b; b = tmp; } } } #region main static class Ex { static public string AsString(this IEnumerable ie) { return new string(ie.ToArray()); } static public string AsJoinedString(this IEnumerable ie, string st = " ") { return string.Join(st, ie.Select(x => x.ToString()).ToArray()); //return string.Join(st, ie); } static public void Main() { Console.SetOut(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); var solver = new Program.Solver(); solver.Solve(); Console.Out.Flush(); } } #endregion