#include <bits/stdc++.h>
using namespace std;

void Print_Stair_path(int n, string path){
    if (n < 0)
    {
        /* code */
        return;
    }
    if (n == 0)
    {
        /* code */
        cout<<path<<endl;
        return;
    }
    Print_Stair_path(n - 1, path + "1");
    Print_Stair_path(n - 2, path + "2");
    Print_Stair_path(n - 3, path + "3");
}
int main(){
    int n;
    cin>>n;
    Print_Stair_path(n, "");
    return 0;
}