
#include <stdio.h>

int table[1000][1000];
int idx = 65;

int idk(a, b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}

void gcd(int a, int b, int x, int y) {
    if (a == 0 || b == 0) return;

    int s = a < b ? a : b;

    for (int i = x; i < x + s; i++)
        for (int j = y; j < y + s; j++)
            table[i][j] = idx;

    idx++;

    if (a < b)
        gcd(a, b - s, x + s, y);
    else
        gcd(a - s, b, x, y + s);
}

int main() {
    int a, b;
    scanf("%d %d", &b, &a);

    gcd(a, b, 0, 0);

    for (int i = 0; i < b; i++) {
        for (int j = 0; j < a; j++)
            printf("%c", (char)table[i][j]);
        printf("\n");
    }

    printf("%d\n", idk(a, b));

    return 0;
}
