#include <fstream>
#include <vector>

using namespace std;

ifstream input("TAOXAU.inp");
ofstream output("TAOXAU.out");

void print(vector <char> &sub)
{
	for (unsigned int i = 0; i < sub.size(); i++)
	{
		output << sub[i] << ' ';
	}
	output << '\n';
}

void taoxau(vector <char> &sub)
{
	for (unsigned int i = sub.size() - 1; i > 0; i--)
	{
		if (sub[i] == 'B' && sub[i - 1] == 'B')
		{
			for (unsigned int i = sub.size() - 1; i >= 0; i--)
			{
				if (sub[i] == 'A')
				{
					sub[i] = 'B';
					break;
				}
				else
				{
					sub[i] = 'A';
					if (i == 0) return;
				}
			}
			taoxau(sub);
			return;
		}
	}
	print(sub);
	for (unsigned int i = sub.size() - 1; i >= 0; i--)
	{
		if (sub[i] == 'A')
		{
			sub[i] = 'B';
			break;
		}
		else
		{
			sub[i] = 'A';
			if (i == 0) return;
		}
	}
	taoxau(sub);
}

int main()
{
	int n;
	input >> n;
	vector <char> sub(n, 'A');
	taoxau(sub);
	input.close();
	output.close();
	return 0;
}