import java.util.*;
public class xiaowuc1 {
  static Scanner sc;
  static Map<String, Integer> dp;
  public static void main(String[] args) throws Exception {
    sc = new Scanner(System.in);
    dp = new HashMap<>();
    int n = sc.nextInt();
    int[] l = new int[n];
    for(int i = 0; i < n; i++) l[i] = i+1;
    for(int i = 1; i <= n; i++) {
      int loc = 0;
      while(l[loc] != i) loc++;
      int baseline = qry(l);
      ArrayList<Integer> cands = new ArrayList<>();
      boolean done = false;
      for(int loc2 = 0; !done && loc2 < n; loc2++) {
        if(l[loc2] <= l[loc]) continue;
        swap(l, loc, loc2);
        if(qry(l) == baseline + 2) {
          done = true;
          break;
        }
        else if(qry(l) > baseline) cands.add(loc2);
        swap(l, loc, loc2);
      }
      if(done || cands.size() == 0) {
        continue;
      }
      if(cands.size() != 2) throw new RuntimeException();
      cycle(l, loc, cands.get(0), cands.get(1));
      if(qry(l) >= baseline + 2) continue;
      cycle(l, loc, cands.get(0), cands.get(1));
    }
    qry(l);
  }
  private static void swap(int[] l, int x, int y) {
    if(x == y) return;
    int t = l[x];
    l[x] = l[y];
    l[y] = t;
  }
  private static void cycle(int[] l, int x, int y, int z) {
    if(x == y) return;
    int t = l[x];
    l[x] = l[y];
    l[y] = l[z];
    l[z] = t;
  }
  private static int qry(int[] l) {
    StringBuilder sb = new StringBuilder();
    for(int i = 0; i < l.length; i++) {
      if(i > 0) sb.append(' ');
      sb.append(l[i]);
    }
    String key = sb.toString();
    if(!dp.containsKey(key)) {
      System.out.println(key);
      dp.put(key, sc.nextInt());
    }
    if(dp.get(key) == l.length) System.exit(0);
    return dp.get(key);
  }
}
