#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, M; cin >> N >> M; string S; cin >> S; vector G(N + 1, vector(N + 1, false)); G[0][0] = true; int x = 0, y = 0; for (auto s : S) { if (s == 'U') y++; if (s == 'R') x++; if (s == 'L') x--; if (s == 'D') y--; G[y][x] = true; } for (int i = N; i > -1; i--) { for (int j = 0; j < N + 1; j++) { cout << (!G[i][j] ? 1 : 0) << (j == N ? '\n' : ' '); } } return 0; }