#include<bits/stdc++.h> using namespace std; struct my{ int k; int i; } a[100100]; bool cmp(my a, my b) { return a.k < b.k; } int n; int main() { cin >> n; for(int i = 0; i < 1<<n; i++) { int j = 0; int aux = i,k = 0; while(j < n) { k += aux%2; aux/=2; j++; } a[i].k = k; a[i].i = i; } sort(a,a+(1<<n),cmp); for(int i = 0; i < 1<<n; i++) { for(int j = 0 ; j < n; j++) { cout << a[i].i%2; a[i].i /= 2; } cout << "\n"; } }