#include #include #define rep(i,n) for(int i = 0; i < n; i++) #define rrep(i,a,b) for(int i = a; i < b; i++) #define all(A) (A).begin(),(A).end() #define MOD 1000000007 #define grt greater() #define mapf(M) for(auto& [k,v] : M) using namespace std; using ll = long long; using P = pair; using pq = priority_queue,greater>; ll INF = 1LL<<60; template bool chmax(T &a,T &b){ if(a < b){ a = b; return true; } return false; } template bool chmin(T &a,T &b){ if(a > b){ a = b; return true; } return false; } struct Edge { int to; int cost; int from; }; using Graph = vector>; using vi = vector; void dfs(string s,vector& ans,int x){ if(x == 1) return; x--; if(x%2 == 0 && x/2 >= 1){ s.push_back('A'); dfs(s,ans,x/2); if(x/2 == 1) ans.push_back(s); s.pop_back(); } if(x%3 == 0 && x/3 >= 1){ s.push_back('B'); dfs(s,ans,x/3); if(x/3 == 1) ans.push_back(s); s.pop_back(); } return; } int main(void){ int n; cin >> n; vector S; string s = ""; dfs(s,S,n); for(string& d:S) reverse(all(d)); for(string& d:S) cout << d << endl; }