*l, c = gets.split h, w = l.map(&:to_i) pattern = 'BW' * 26 j = c == 'B' ? 0 : 1 h.times { |i| puts pattern[i % 2 + j, w] }