#include<bits/stdc++.h>

using namespace std;

const int N = 1000 + 10;

int a[N][N];

int main() {
    srand(time(NULL));
    //freopen("test.txt", "w", stdout);
    int n;
    cin >> n;
    const char tiles[6] = {'f', 'g', 'G', 'h', 'm', 'r'};
    const int values[6] = {3, 1, 2, 4, 7, 5};
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            a[i][j] = rand() % 6;
        }
    }

    cout << n;
    for (int i = 0; i < 6; ++i) {
        cout << endl << tiles[i] << " " << values[i];
    }

    for (int i = 0; i < n; ++i) {
        cout << endl;
        for (int j = 0; j < n; ++j) {
            if (j > 0) cout << " ";
            cout << tiles[a[i][j]];
        }
    }
    cout << endl << "0 0";
    cout << endl << n - 1 << " " << n - 1;
}
