#include using namespace std; using ll = long long; #define all(x) begin(x), end(x) #define rep(i,a,b) for (auto i = a; i < (b); ++i) #define vi vector #define pii pair #define W(x) cerr << #x << ": " << (x) << "\n"; struct train { int p; int s; int d; // -1 = left int l; int ep; int beg, end; }; vector tr; int main () { cin.tie(0)->sync_with_stdio(0); int n, m, t; cin >> n >> m >> t; tr.reserve(m); rep(i,0,m){ int p, s, l; char d; cin >> p >> s >> d >> l; tr.push_back({p, s, (d == 'L'? -1 : 1), l, (d == 'L'? p: p + l -1), 0, 0}); } for(auto &e: tr){ e.ep += t*e.s*e.d; if(e.d == 1){ e.end = e.ep; e.beg = e.ep - e.l + 1; }else{ e.beg = e.ep; e.end = e.ep + e.l - 1; } } rep(y,0,m){ auto &e = tr[y]; rep(x,0,n){ if(e.ep == x){ cout << "!"; }else if(x >= e.beg && x <= e.end){ cout << "#"; }else{ cout << "="; } } cout << "\n"; } // XXX return 0; }