Some scientists are working on protein recombination, and during their research, they have found a remarkable fact: there are 4 proteins in the protein ring that mutate after every second according to a fixed pattern. For simplicity, proteins are called $A,B,C,D$ (you know, protein names can be very complicated). A protein mutates into another one depending on itself and the protein right after it. Scientists determined that the mutation table goes like this:  

    A   B   C   D
    _   _   _   _
A|  A   B   C   D
B|  B   A   D   C
C|  C   D   A   B
D|  D   C   B   A

Here rows denote the protein at current position, while columns denote the protein at the next position. And the corresponding value in the table denotes the new protein that will emerge. So for example, if protein i is A, and protein i + 1 is B, protein i will change to B. All mutations take place simultaneously. The protein ring is seen as a circular list, so last protein of the list mutates depending on the first protein. 

Using this data, they have written a small simulation software to get mutations second by second. The problem is that the protein rings can be very long (up to 1 million proteins in a single ring) and they want to know the state of the ring after upto $\mathbf{10^{9}}$ seconds. Thus their software takes too long to report the  results. They ask you for your help.  

Input Format

Input contains 2 lines. 

First line has 2 integers $N$ and $\mbox{K}$, $N$ being the length of the protein ring and $\mbox{K}$ the desired number of seconds. 

Second line contains a string of length $N$ containing uppercase letters $\mbox{A}$,$\mbox{B}$, $\mbox{C}$ or $\mbox{D}$ only, describing the ring. 

Constraints

$1\leq N\leq10^6$ 

$1\leq K\leq10^9$ 

Output Format

Output a single line with a string of length $N$, describing the state of the ring after $\mbox{K}$ seconds.

Sample Input 0
5 15
AAAAD

Sample Output 0
DDDDA

Explanation 0

The complete sequence of mutations is:

AAADD
AADAD
ADDDD
DAAAD
DAADA
DADDD
DDAAA
ADAAD
DDADD
ADDAA
DADAA
DDDAD
AADDA
ADADA
DDDDA

Source: hackerrank | Difficulty: MEDIUM_HARD
Tags: Bit manipulation


Solutions:
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


def shift_schematic(second):
	(current_second, i) = (0, 0)
	while current_second < second:
		power = pow(2, i)
		if current_second + power <= second:
			yield power
			current_second += power
			i += 1
		else:
			i -= 1

def mutation_at_second(proteins, n, seconds):
	for i in shift_schematic(seconds):
		proteins = [proteins[ix] ^ proteins[(ix + i) % n] for ix in range(n)]
	return proteins
(n, seconds) = map(int, input().split())
schematic = str.maketrans('ABCD', '0154')
inv_schema = str.maketrans('0154', 'ABCD')
proteins = list(map(int, input().translate(schematic)))
resulting_mutation = ''.join(map(str, mutation_at_second(proteins, n, seconds)))
resulting_mutation = resulting_mutation.translate(inv_schema)
print(resulting_mutation)


import sys
(n, k) = [int(v) for v in sys.stdin.readline().split()]
s = sys.stdin.readline().strip()
a = [0] * n
for i in range(n):
	a[i] = ord(s[i]) - ord('A')
exp = k
power = 1
while exp > 0:
	if exp & 1 == 1:
		r = power % n
		b = [a[i] for i in range(n)]
		for i in range(n):
			b[i] ^= a[(i + r) % n]
		a = b
	exp >>= 1
	power <<= 1
Gene = ['A', 'B', 'C', 'D']
print(''.join([Gene[a[i]] for i in range(n)]))


def bin(n):
	ret = []
	start = 1 << 31
	while start > 0:
		if start & n:
			ret.append(start)
		start >>= 1
	return ret
(n, k) = [int(x) for x in input().split()]
arr = [ord(x) - ord('A') for x in input()]
for power in bin(k):
	tmp = [arr[i] ^ arr[(i + power) % n] for i in range(n)]
	arr = tmp
print(''.join([chr(ord('A') + ch) for ch in arr]))


def sn(c):
	return ord(c) - ord('A')

def ns(s):
	return chr(ord('A') + s)
(l, t) = map(int, input().split())
c = [sn(i) for i in input()]
s = 1
while t > 0:
	(t, b) = divmod(t, 2)
	if b:
		c = [c[i] ^ c[(i + s) % l] for i in range(l)]
	s *= 2
print(''.join(map(ns, c)))


def stringToInts(s):
	base = ord('A')
	return [ord(c) - base for c in s]

def shiftAndXor(arr, n):
	l = len(arr)
	return [arr[i] ^ arr[(i + n) % l] for i in range(l)]

def intsToString(arr):
	base = ord('A')
	chars = [chr(x + base) for x in arr]
	return ''.join(chars)

def xorRing(arr, K):
	pow2 = 1
	while K > 0:
		if K % 2 == 1:
			arr = shiftAndXor(arr, pow2)
		K //= 2
		pow2 *= 2
	return arr
(N, K) = map(int, input().strip().split())
S = input().strip()
print(intsToString(xorRing(stringToInts(S), K)))


import functools
(n, m) = map(int, input().split(' '))
print(''.join(map(lambda c: chr(c + ord('A')), functools.reduce(lambda s, k: [s[i] ^ s[(i + (1 << k)) % n] for i in range(n)] if m & 1 << k else s, range(61), [ord(x) - ord('A') for x in input()]))))


(N, K) = map(int, input().split())
S = input().strip()
A = [ord(c) - 65 for c in S]
h = 1
while h <= K:
	if h & K:
		A = [A[i] ^ A[(i + h) % N] for i in range(N)]
	h <<= 1
S = ''.join((chr(c + 65) for c in A))
print(S)


from math import log
(_, seconds) = input().strip().split()
seconds = int(seconds)
chars_in = input().strip()
state = list([x for x in map('ABCD'.index, chars_in)])
nchars = len(state)
max_k = 5000000
max_p = int(log(max_k, 2))

def xform(a, k):
	ret = a[:]
	l = len(a)
	step = 1
	while step <= k:
		if k & step:
			ret = [ret[x] ^ ret[(x + step) % l] for x in range(l)]
		step <<= 1
	return ret
state = xform(state, seconds)
final = ''.join([chr(ord('A') + x) for x in state])
print(final)


import sys
(n, k) = [int(v) for v in sys.stdin.readline().split()]
s = sys.stdin.readline().strip()
a = [0] * n
for i in range(n):
	a[i] = ord(s[i]) - ord('A')
exp = k
power = 1
while exp > 0:
	if exp & 1 == 1:
		r = power % n
		b = [a[i] for i in range(n)]
		for i in range(n):
			b[i] ^= a[(i + r) % n]
		a = b
	exp >>= 1
	power <<= 1
Gene = ['A', 'B', 'C', 'D']
print(''.join([Gene[a[i]] for i in range(n)]))


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


(N, M) = map(int, input().split(' '))
A = [ord(L) - ord('A') for L in input()]
S = f'{M:064b}'
for i in range(len(S)):
	if S[i] == '1':
		delta = pow(2, 64 - i - 1, N)
		A = [A[j] ^ A[(j + delta) % N] for j in range(len(A))]
print(''.join([chr(ord('A') + V) for V in A]))


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
c = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i = ['A', 'B', 'C', 'D']
(num, kt) = [int(x) for x in input().strip().split()]
s = [c[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while kt > 0:
	a ^= b
	b ^= a
	a ^= b
	cp = 1
	for j in range(29, 0, -1):
		if kt - (1 << j) >= 0:
			cp = 1 << j
			break
	kt -= cp
	for j in range(num):
		s[b][j] = s[a][j] ^ s[a][(j + cp) % num]
for j in s[b]:
	sys.stdout.write(i[j])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()


import math
import os
import random
import re
import sys
import sys
c2i = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
i2c = ['A', 'B', 'C', 'D']
(n, k) = [int(x) for x in input().strip().split()]
s = [c2i[x] for x in input().strip()]
s = [s, [0] * len(s)]
(a, b) = (1, 0)
while k > 0:
	a ^= b
	b ^= a
	a ^= b
	cp2 = 1
	for i in range(29, 0, -1):
		if k - (1 << i) >= 0:
			cp2 = 1 << i
			break
	k -= cp2
	for i in range(n):
		s[b][i] = s[a][i] ^ s[a][(i + cp2) % n]
for i in s[b]:
	sys.stdout.write(i2c[i])
sys.stdout.flush()