// Wrong Answer
// N = 1 : more than 1 types of blocks deleted
// N = 2 : output 0
// N = 3 : more than 3 blocks deleted
// N = 4 : S has non-digit char
// N = 5 : S length is shorter than N
// N = 6 : S length is longer than N
// N = 7 : output less than 6 strings
// N = 8 : 0 blocks deleted


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

vector<string> ans1 =
{

"1",
"1",
"1",
"0",
"0",
"0"

};

vector<string> ans3 = 
{

"012",
"342",
"342",
"222",
"141",
"300"

};

vector<string> ans4 =
{

"4551",
"3662",
"6777",
"3AA5",
"3442",
"A112"

};

vector<string> ans5 =
{

"4551",
"3662",
"6777",
"3005",
"3442",
"0112"

};

vector<string> ans6 =
{

"4551999",
"366299",
"677799",
"300599",
"344299",
"011299"

};

vector<string> ans7 =
{

"4551999",
"3662999",
"6777999",
"3005999",
"3442999"

};

vector<string> ans8 =
{

"01234567",
"12345678",
"23456789",
"34567890",
"45678901",
"56789012"

};

int main(){
    int n; cin >> n;
    if (n == 1){
        for (int i = 0; i < 6; i++){
            cout << ans1[i] << endl; // WA
        }
        return 0;
    }
    if (n == 2){
        cout << 0 << endl; // WA
        return 0;
    }
    if (n == 3){
        for (int i = 0; i < 6; i++){
            cout << ans3[i] << endl; // WA
        }
        return 0;
    }
    if (n == 4){
        for (int i = 0; i < 6; i++){
            cout << ans4[i] << endl; // WA
        }
        return 0;
    }
    if (n == 5){
        for (int i = 0; i < 6; i++){
            cout << ans5[i] << endl; // WA
        }
        return 0;
    }
    if (n == 6){
        for (int i = 0; i < 6; i++){
            cout << ans6[i] << endl; // WA
        }
        return 0;
    }
    if (n == 7){
        for (int i = 0; i < 6; i++){
            cout << ans7[i] << endl; // WA
        }
        return 0;
    }
    if (n == 8){
        for (int i = 0; i < 6; i++){
            cout << ans8[i] << endl; // WA
        }
        return 0;
    }
}