#include <iostream>
#include <iomanip>
 
using namespace std;
 
int main() {
    int N;
    cin >> N;
 
    if (N <= 0 || N >= 10) {
        cout << "Invalid input. Please enter a number between 1 and 9." << endl;
        return 1;
    }
 
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            char ch = 'A' + (i + j) % N;
            cout << setw(3) << ch;
        }
        cout << endl;
    }
 
    return 0;
}
/**************************************************************
	Problem: 1194
	User: linzihang
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/