by@akouryy1
AC
2560ms
a=gets;puts$<.map{|l|$_=l;a};$_[a=~/T/]=?A;0while$_.sub!'K ','KK';print
T K
T T T T T T T T T T T KKKKKKKKKKKKKKKKKKKKKKKKKKKA