from collections import deque n,k = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) lis = [] for i in range(n): diff = a[i] - b[i] lis.append([a[i],b[i],diff,i]) lis2 = sorted(lis,key=lambda x:x[2])[::-1] select_a = set() for i in range(k): select_a.add(lis2[i][3]) ans = deque() for i in range(n): if(i in select_a): ans.append('A') else: ans.append('B') print(''.join(ans))