#include #include #include using namespace std; int main() { int N, K; cin >> N >> K; vector A(N), B(N), perm(N); for (int i = 0; i < N; ++i) { cin >> A[i] >> B[i]; perm[i] = i; } sort(perm.begin(), perm.end(), [&](int i, int j) { return A[i] - B[i] > A[j] - B[j]; }); string ans(N, 'B'); for (int i = 0; i < K; ++i) { ans[perm[i]] = 'A'; } cout << ans << endl; return 0; }