n, k = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) flag = False if k > n//2: flag = True A, B = B, A k = n-k dp = [[-1000010000]*(k+1) for _ in range(n+1)] ans = [['0']*(k+1) for _ in range(n+1)] dp[0][0] = 0 for i in range(n): for j in range(k+1): dp[i+1][j] = max(dp[i+1][j], dp[i][j]+B[i]) if j <= k and j > 0: dp[i+1][j] = max(dp[i+1][j], dp[i][j-1]+A[i]) if dp[i+1][j] == dp[i][j]+B[i]: ans[i+1][j] = ans[i][j]+'B' else: ans[i+1][j] = ans[i][j-1]+'A' print(ans[-1][-1][1:])