N, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) AB = list(tuple(zip(A, B, range(N)))) AB.sort(key=lambda x: x[0]-x[1], reverse=True) result = [None] * N for k in range(K): result[AB[k][2]] = "A" print("".join([a if a == "A" else "B" for a in result]))