#include using namespace std; using ll = long long; using ull = unsigned long long; bool R(char dir) { return dir == 'R'; } bool L(char dir) { return dir == 'L'; } bool out_of_bounds(int i, int n) { return (i < 0 || i >= n); } bool in_bounds(int i, int n) { return !out_of_bounds(i, n); } void solve() { int n, m, t; cin >> n >> m >> t; int cp = m; while (cp--) { char dir; int pos, speed, len; cin >> pos >> speed >> dir >> len; int idx = R(dir) ? pos + t * speed : pos - t * speed; if (R(dir)) { for (int i = 0; i < idx; ++i) { if (in_bounds(i, n)) cout << "="; } while (--len) { if (in_bounds(idx, n)) cout << "#"; ++idx; } if (in_bounds(idx, n)) cout << "!"; ++idx; for (int i = idx; i < n; ++i) { if (in_bounds(i, n)) cout << "="; } } if (L(dir)) { for (int i = 0; i < idx; ++i) { if (in_bounds(i, n)) cout << "="; } if (in_bounds(idx, n)) cout << "!"; ++idx; while (--len) { if (in_bounds(idx, n)) cout << "#"; ++idx; } for (int i = idx; i < n; ++i) { if (in_bounds(i, n)) cout << "="; } } cout << "\n"; } } int main() { ios::sync_with_stdio(0); cin.tie(0); solve(); return 0; }