#include using namespace std; using ll = long long; void process(ll n, ll t) { ll p, s, l; char d; cin >> p >> s >> d >> l; ll dir = (d == 'L') ? -1 : 1; ll motor = (d == 'L') ? p : p + l - 1; // cout << t << ";" << s << endl; // cout << motor << endl; motor += t * s * dir; // cout << motor << endl; for (ll i = 0; i < n; ++i) { if (i == motor) { cout << '!'; continue; } if (dir == -1) { if (i > motor && i < motor + l) { cout << '#'; } else { cout << '='; } } else { if (i < motor && i > motor - l) { cout << '#'; } else { cout << '='; } } } cout << "\n"; } int main() { std::ios::sync_with_stdio(false); ll n, m, t; cin >> n >> m >> t; for (ll i = 0; i < m; ++i) { process(n, t); } cout.flush(); return 0; }