import java.io.FileNotFoundException; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } void preorder(int pos,int[] a) { if(pos>=a.length)return; ans.addLast(a[pos]); preorder(2*pos,a); preorder(2*pos+1,a); } //v=その部分木に含まれる最小の数 //返り値=その部分木に含まれる最大の数 int dfs(int pos,int v,int res,int[] a) { if(res==0) return a[pos]=v; a[pos]=dfs(2*pos,v,res-1,a)+1; return dfs(2*pos+1,a[pos]+1,res-1,a); } Scanner sc = new Scanner(System.in); ArrayDeque ans=new ArrayDeque<>(); void run() { int K=sc.nextInt(); int[] a=new int[1<<(K-1)]; dfs(1,1,K-2,a); preorder(1, a); ans.addFirst((1<<(K-1))); ans.addFirst((1<<(K-1))+1); a=new int[1<<(K-1)]; dfs(1,(1<<(K-1))+2,K-2,a); preorder(1, a); while(ans.peekLast()>=1<