//Normal #define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; void print(auto a){ cout << a; } void prints(auto a){ cout << a << " "; } void prints(){ cout << " "; } void printl(auto a){ cout << a << endl; } void printl(){ cout << endl; } void fix(int n){ cout << fixed << setprecision(n); } int siz(string s){ return (int)s.size(); } int main(){ vector> X(210, vector(210, 1)); int N; cin >> N; int a = 1, b = N+1; X[b][a] = 0; int M; cin >> M; string S; cin >> S; for(int i = 0; i < M; i++){ switch(S[i]){ case 'U': b--; break; case 'R': a++; break; case 'L': a--; break; case 'D': b++; break; } X[b][a] = 0; } for(int i = 1; i <= N+1; i++){ for(int j = 1; j <= N+1; j++){ j==N+1 ? printl(X[i][j]) : prints(X[i][j]); } } return 0; }