import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); String s = sc.next(); int arr[][] = new int[n+1][n+1]; for(int i = 0; i < n+1; i++){ for(int j = 0; j < n+1; j++){ arr[i][j] = 1; } } arr[0][0] = 0; int i = 0, j = 0; for(int x = 0; x < m; x++){ switch(s.charAt(x)){ case 'R': j++; break; case 'L': j--; break; case 'U': i++; break; case 'D': i--; break; } arr[i][j] = 0; } for(int k = n; k >= 0; k--){ for(int l = 0; l <= n; l++){ if(l > 0) System.out.print(" "); System.out.print(arr[k][l]); } System.out.println(); } } }