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

int main()
{
    size_t N;
    cin >> N;

    size_t ans = (1 << (N)) - 1;
    cout << ans << endl;

    for (size_t i = 1; i <= ans; i++)
    {
        for (size_t j = 0; j < ((size_t)1 << N); j++)
        {
            if (bitset<32>(i & j).count() % 2 == 0)
            {
                cout << 'A';
            }
            else
            {
                cout << 'B';
            }
        }
        cout << endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int64_t N;
	cin>>N;
	for (int64_t a=3;a<=N;a*=3){
		int64_t b=5;
		while (b<=N-a){
			if (a+b==N){
				int cnt1=0,cnt2=0;
				int64_t tmp1=1,tmp2=1;
				while (tmp1!=a) {
					tmp1*=3;
					cnt1++;
				}
				while (tmp2!=b) {
					tmp2*=5;
					cnt2++;
				}
				cout<<cnt1<<" "<<cnt2<<'\n';\
				return 0;
			}
			b*=5;
		}
	}
	cout<<-1<<'\n';
}