#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climits>
#include <bitset>
#include <cassert>

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;

int dp[110];

int rec(int n){
	if (n == 1) return 0;

	int &res = dp[n];
	if (res + 1) return res;

	set<int> st;
	if(n >= 2){
		if (n % 2 == 0) st.insert(0);
		if (n % 2 == 1) st.insert(rec(n / 2) ^ rec(n / 2 + 1));
	}
	if(n >= 3){
		if (n % 3 != 1) st.insert(rec(n / 3));
		if (n % 3 == 1) st.insert(rec(n / 3 + 1));
	}

	for (int i = 0;; ++i) if (!st.count(i)) return res = i;	
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(20);

	int n;
	cin >> n;

	MEMSET(dp, -1);
	cout << (rec(n) ? "A" : "B") << endl;

}