#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
inline int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
int main(){
	int n=read();
	cout<<(1<<n)-1<<"\n";
	F(i,1,(1<<n)-1){
		F(j,0,(1<<n)-1){
			cout<<((__builtin_popcount(i&j)&1)&1 ? 'A' : 'B');
		}
		cout<<"\n";
	}
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0), cout << setprecision(15);
#define ll long long int
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, k, n) for (ll i = k; i>=n; i--)
#define repp(i, k, n) for (ll i = k; i < (n); i++)
#define pb push_back
#define all(x) begin(x), end(x)
#define vc vector<ll>
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>

using namespace __gnu_pbds;
using namespace std;


int main() {
    FAST_IO
    string s;
    cin >> s;
    bool ans = true;
    rep(i, s.size()) {
        if (i % 2 == 0) ans &= bool(islower(s[i]));
        else ans &= bool(isupper(s[i]));
    }
    if (ans) cout << "Yes";
    else cout << "No";
    return 0;
}