import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val n = nextInt() val k = nextInt() val a = Array(n) { nextInt() } val b = Array(n) { nextInt() } val lst = mutableListOf>() for (i in 0 until n) { lst.add(Triple(a[i], i, true)) lst.add(Triple(b[i], i, false)) } lst.sortByDescending { it.first } val choice = CharArray(n) { '.' } var a_rem = k var b_rem = n - k for ((v, i, is_a) in lst) { if (a_rem == 0 || b_rem == 0) break if (is_a && choice[i] == '.') { choice[i] = 'A' a_rem-- } else if (!is_a && choice[i] == '.') { choice[i] = 'B' b_rem-- } } for (i in 0 until n) { if (choice[i] == '.') { if (a_rem == 0) choice[i] = 'B' else choice[i] = 'A' } } println(choice.joinToString("")) } fun main() { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion