import java.util.Scanner; public class HelloWorld { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m =sc.nextInt(); sc.nextLine(); String[] strs = sc.nextLine().split(""); sc.close(); int[][] matrix = new int[n+1][n+1]; int[] position_now = {n,0}; matrix[position_now[0]][position_now[1]] = -1; for (int i = 0; i < m; i ++) { if (strs[i].equals("R")) { position_now[1]++; } if (strs[i].equals("U")) { position_now[0]--; } if (strs[i].equals("L")) { position_now[1]--; } if (strs[i].equals("D")) { position_now[0]++; } matrix[position_now[0]][position_now[1]] = -1; } for (int i = 0; i < n+1; i ++) { for (int j = 0; j < n + 1; j ++) { System.out.print(matrix[i][j]==-1? "0":"1"); if (j == n) { break; } System.out.print(" "); } System.out.println(); } } }