import java.util.*; import java.lang.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); char[] s = sc.next().toCharArray(); int[][] kimwipes = new int[n+1][n+1]; for(int i = 0 ; i <= n ; i++){ Arrays.fill(kimwipes[i] , 1); } int x = 0; int y = 0; kimwipes[0][0] = 0; for(int i = 0 ; i < s.length ; i++){ char c = s[i]; if(c == 'U' && y < n){ kimwipes[y+1][x] = 0; y++; }else if(c == 'D' && y > 0){ kimwipes[y-1][x] = 0; y--; }else if(c == 'R' && x < n){ kimwipes[y][x+1] = 0; x++; }else if(c == 'L' && x > 0){ kimwipes[y][x-1] = 0; x--; } } for(int i = n ; i >= 0 ; i--){ for(int j = n ; j >= 0 ; j--){ System.out.print(kimwipes[i][j]+" "); } System.out.println(); } } }