#include <iostream> #include <vector> #include <algorithm> using namespace std; #define REP(i,a) for (int i = 0; i < (a); i++) #define FOR(i,a,b) for (int i = (a); i <= (b); i++) #define ROF(i,a,b) for (int i = (a); i >= (b); i--) #define SZ(x) (int)(x).size() vector<string> v; bool comp(string a,string b) { int g1 = 0,g2 = 0; FOR(i,0,SZ(a)-1) if (a[i] == '1') g1++; FOR(i,0,SZ(b)-1) if (b[i] == '1') g2++; return g1 < g2; } int main() { ios_base::sync_with_stdio(false); int n; cin >> n; FOR(i,0,(1<<n)-1) { string nr = ""; ROF(j,n-1,0) { if ((1<<j)&i) nr.push_back('1'); else nr.push_back('0'); } v.push_back(nr); } sort(v.begin(),v.end(),comp); REP(i,SZ(v)) cout << v[i] << "\n"; }