import java.util.*;
public class Main{
static int n = 0;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
dfs(0, 0);
}
private static void dfs(int u, int state){
if(u == n){
for(int i = 0; i < n; i++){
if((state >> i & 1) == 1){
System.out.print(i+1+" ");
}
}
System.out.println();
return;
}
dfs(u+1,state);
dfs(u+1, state | 1<<u);
}
}