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