eval'R,K='+gets.split*?, gets eval("$<.map{|s|s.chop.chars}"+".reverse.transpose"*(R/2)).map{|s|puts [s.map{|c|c*K}*'']*K}