
#include <iostream>
using namespace std;
ofstream fo("taphop.out");
ifstream fi("taphop.inp");
#include <iomanip>
int *khoi_tao(int &k, int *a){

	a = new int[k];
	for(int i = 0; i < k; i++){
		a[i] = i + 1;
	}
	return a;
}
// Ham in ket qua
void ket_qua(int *a, int &dem, int k){
	for(int i = 0; i < k; i++) {
		fo << setw(2) << a[i];
	}
	dem++;
	fo << endl;
}
// Ham sinh day ke tiep
void ham_sinh(int *a, int n, int k, int &stop){
	int  i = k - 1;
	while(i >= 0 && a[i] == n - k + i + 1){
		i--;
	}
	if(i >= 0){
		a[i]++ ;
		for(int j = i + 1; j < k ; j ++){
			a[j] = a[i] + j - i ;
		}
	} else{
		stop = 1;
	}
}
// Ham xu ly 
void xu_ly(int *a, int n, int k, int &stop, int &dem){
	while ( !stop ){
		ket_qua(a, dem, k);
		ham_sinh(a, n, k, stop);
	}
}
int main(){
	int n, k,j, stop = 0, dem = 1, *a;
	fi >> n;
	for(k=1;k<=n;k++)
	{a = khoi_tao(k, a);
	xu_ly(a, n, k, stop, dem);
	delete a;}
	return 0;
}