#include using namespace std; int main() { int n, k; cin >> n >> k; int A[n], B[n], i, j; for(i = 0; i < n; i++) cin >> A[i]; for(i = 0; i < n; i++) cin >> B[i]; int cnt = 0; long long sm = 0; int diff[n]; string str(n, 'a'); for(i = 0; i < n; i++) { if(A[i] >= B[i]) cnt++; diff[i] = A[i] - B[i]; } if(k > cnt) { priority_queue, vector>, greater>> pq; for(i = 0; i < n; i++) { if(A[i] >= B[i]) str[i] = 'A'; else if(B[i] > A[i]) pq.push({diff[i], i}); } i = 0; while(i < n - k) { pair pii = pq.top(); pq.pop(); str[pii.second] = 'B'; i++; } while(!pq.empty()) { pair pii = pq.top(); pq.pop(); str[pii.second] = 'A'; } } else { priority_queue> pq; for(i = 0; i < n; i++) { if(B[i] >= A[i]) str[i] = 'B'; else pq.push({diff[i], i}); } i = 0; while(i < k) { pair pii = pq.top(); pq.pop(); str[pii.second] = 'A'; i++; } while(!pq.empty()) { pair pii = pq.top(); pq.pop(); str[pii.second] = 'B'; } } cout << str; return 0; }