#include using namespace std; using Int = int_fast64_t; using Word = uint_fast64_t; using VInt = vector; using VWord = vector; using VB = vector; using VVB = vector; int main() { ios_base::sync_with_stdio(0); cin.tie(0); Int n, m; cin >> n >> m; VVB vis(n + 1, VB(n + 1)); vis[0][0] = true; Int x = 0; Int y = 0; string s; cin >> s; for (char c : s) { if (c == 'U') y++; else if (c == 'D') y--; else if (c == 'R') x++; else x--; vis[y][x] = true; } for (Int i = 0; i <= n; i++) { for (Int j = 0; j <= n; j++) { if (j) cout << " "; if (vis[n - i][j]) cout << 0; else cout << 1; } cout << '\n'; } return 0; }