#include<iostream>
#include<algorithm>
#include<cstring>
#include<math.h>
#include<iomanip>
#include<queue>
#define PI acos(-1)
#include<algorithm>
#include<string>
#include<sstream>
#include<vector>
#include<map>
#include<unordered_map>
#include<deque>
#include<limits>
#include<stack>
#include<set>
#include<unordered_set>
#include<cmath>
#include<cstring>
#include<string.h>
#include<ctype.h>
#include<numeric>
#include<stdexcept>
#define rep(i,a,b) for(int i=a ; i<b ; i++)
#define ll long long
using namespace std;
const int N = 2e5+5;
const int M = 1e9 +7;
vector<int> g[N];
vector<bool> vis(N,0);
vector<int> h(N,0);
vector<int> num(N,0);
void bfs(int node){
//cout<<node<<" "<<no<<'\n';
queue<int> q;
q.push(node);
vis[node] = 1;
num[node] = 1;
while( !q.empty() ){
int n = q.front();
q.pop();
for(int child: g[n]){
//cout<<child<<" "<<h[child]<<" "<<num[child]<<"{}\n";
if( !vis[child]){
vis[child] = 1;
q.push(child);
num[child] = num[n];
h[child] = h[n]+1;
}
else if( h[n]+1 == h[child]){
num[child] = (num[child]%M +num[n]%M)%M;
}
}
}
return;
}
int main(){
int r , co, x;
cin >> r >> co;
char grid[r][co];
cin >> x;
for(int i = 0 ; i < r ;i++){
for(int j = 0 ; j < co ; j++){
grid[i][j] = ' ';
}
}
while(x--){
char o;
cin >> o;
if( o == 'L'){
int a , b , c , d;
cin >> a >> b >> c >> d;
if( a == c ){
if( b > d)swap(b,d);
for(int i = b ; i <= d ; i++){
grid[a][i] = '*';
}
}
else if( b == d){
if( a > c)swap(a,c);
for(int i = a ; i <= c ; i++){
grid[i][b] = '*';
}
}
else{
for(int i = min(a,c) ; i <= max(a,c) ;i++){
grid[i][i] = '*';
}
}
}
else if( o == 'R'){
int a , b , c , d;
cin >> a >> b >> c >> d;
for(int i = a ; i <= c ; i++){
grid[a][i] = '*';
grid[c][i] = '*';
}
for(int i = a ; i <= c ; i++){
grid[i][a] = '*';
grid[i][c] = '*';
}
}
else if(o == 'F'){
char a;
int b , c;
cin >> a >> b >> c;
for(int i = 0 ; i < r ; i++){
for(int j = 0 ; j < co ; j++){
if( grid[i][j] =='*')continue;
else if( i == b and j == c)continue;
else grid[i][j] = a;
}
}
}
}
for(int i = 0 ; i < r ; i++){
for(int j = 0 ; j < co ;j++ )
cout<<grid[i][j];
cout<<'\n';
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2luY2x1ZGU8Y3N0cmluZz4KI2luY2x1ZGU8bWF0aC5oPgojaW5jbHVkZTxpb21hbmlwPgojaW5jbHVkZTxxdWV1ZT4KI2RlZmluZSBQSSBhY29zKC0xKQojaW5jbHVkZTxhbGdvcml0aG0+CiNpbmNsdWRlPHN0cmluZz4KI2luY2x1ZGU8c3N0cmVhbT4KI2luY2x1ZGU8dmVjdG9yPgojaW5jbHVkZTxtYXA+CiNpbmNsdWRlPHVub3JkZXJlZF9tYXA+CiNpbmNsdWRlPGRlcXVlPgojaW5jbHVkZTxsaW1pdHM+CiNpbmNsdWRlPHN0YWNrPgojaW5jbHVkZTxzZXQ+CiNpbmNsdWRlPHVub3JkZXJlZF9zZXQ+CiNpbmNsdWRlPGNtYXRoPgojaW5jbHVkZTxjc3RyaW5nPgojaW5jbHVkZTxzdHJpbmcuaD4KI2luY2x1ZGU8Y3R5cGUuaD4KI2luY2x1ZGU8bnVtZXJpYz4KI2luY2x1ZGU8c3RkZXhjZXB0PgojZGVmaW5lIHJlcChpLGEsYikgZm9yKGludCBpPWEgOyBpPGIgOyBpKyspCiNkZWZpbmUgbGwgbG9uZyBsb25nCgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBOID0gMmU1KzU7CmNvbnN0IGludCBNID0gMWU5ICs3OwoKdmVjdG9yPGludD4gZ1tOXTsKdmVjdG9yPGJvb2w+IHZpcyhOLDApOwp2ZWN0b3I8aW50PiBoKE4sMCk7CnZlY3RvcjxpbnQ+IG51bShOLDApOwoKdm9pZCBiZnMoaW50IG5vZGUpewogICAgLy9jb3V0PDxub2RlPDwiICI8PG5vPDwnXG4nOwogICAgCiAgICBxdWV1ZTxpbnQ+IHE7CiAgICBxLnB1c2gobm9kZSk7CiAgICB2aXNbbm9kZV0gPSAxOwogICAgbnVtW25vZGVdID0gMTsKICAgIHdoaWxlKCAhcS5lbXB0eSgpICl7CiAgICAgICAgaW50IG4gPSBxLmZyb250KCk7CiAgICAgICAgcS5wb3AoKTsKICAgICAgICAKICAgICAgICBmb3IoaW50IGNoaWxkOiBnW25dKXsKICAgICAgICAgICAgLy9jb3V0PDxjaGlsZDw8IiAiPDxoW2NoaWxkXTw8IiAiPDxudW1bY2hpbGRdPDwie31cbiI7CiAgICAgICAgICAgIGlmKCAhdmlzW2NoaWxkXSl7CiAgICAgICAgICAgICAgICB2aXNbY2hpbGRdID0gMTsKICAgICAgICAgICAgICAgIHEucHVzaChjaGlsZCk7CiAgICAgICAgICAgICAgICBudW1bY2hpbGRdID0gbnVtW25dOwogICAgICAgICAgICAgICAgaFtjaGlsZF0gPSBoW25dKzE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiggaFtuXSsxID09IGhbY2hpbGRdKXsKICAgICAgICAgICAgICAgIG51bVtjaGlsZF0gPSAobnVtW2NoaWxkXSVNICtudW1bbl0lTSklTTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHJldHVybjsKfQoKCgppbnQgbWFpbigpewogICAgaW50IHIgLCBjbywgeDsKICAgIGNpbiA+PiByID4+IGNvOwogICAgY2hhciBncmlkW3JdW2NvXTsKICAgIGNpbiA+PiB4OwogICAgZm9yKGludCBpID0gMCA7IGkgPCByIDtpKyspewogICAgICAgIGZvcihpbnQgaiA9IDAgOyBqIDwgY28gOyBqKyspewogICAgICAgICAgICBncmlkW2ldW2pdID0gJyAnOwogICAgICAgIH0KICAgIH0KICAgIHdoaWxlKHgtLSl7CiAgICAgICAgY2hhciBvOwogICAgICAgIGNpbiA+PiBvOwogICAgICAgIGlmKCBvID09ICdMJyl7CiAgICAgICAgCWludCBhICwgYiAsIGMgLCBkOwogICAgICAgICAgICBjaW4gPj4gYSA+PiBiID4+IGMgPj4gZDsKICAgICAgICAgICAgCiAgICAgICAgICAgIGlmKCBhID09IGMgKXsKICAgICAgICAgICAgICAgIGlmKCBiID4gZClzd2FwKGIsZCk7CiAgICAgICAgICAgICAgICBmb3IoaW50IGkgPSBiIDsgaSA8PSBkIDsgaSsrKXsKICAgICAgICAgICAgICAgICAgICBncmlkW2FdW2ldID0gJyonOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgaWYoIGIgPT0gZCl7CiAgICAgICAgICAgICAgICBpZiggYSA+IGMpc3dhcChhLGMpOwogICAgICAgICAgICAgICAgZm9yKGludCBpID0gYSA7IGkgPD0gYyA7IGkrKyl7CiAgICAgICAgICAgICAgICAgICAgZ3JpZFtpXVtiXSA9ICcqJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgZm9yKGludCBpID0gbWluKGEsYykgOyBpIDw9IG1heChhLGMpIDtpKyspewogICAgICAgICAgICAgICAgICAgIGdyaWRbaV1baV0gPSAnKic7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiggbyA9PSAnUicpewogICAgICAgICAgICBpbnQgYSAsIGIgLCBjICwgZDsKICAgICAgICAgICAgY2luID4+IGEgPj4gYiA+PiBjID4+IGQ7CiAgICAgICAgICAgIGZvcihpbnQgaSA9IGEgOyBpIDw9IGMgOyBpKyspewogICAgICAgICAgICAgICAgZ3JpZFthXVtpXSA9ICcqJzsKICAgICAgICAgICAgICAgIGdyaWRbY11baV0gPSAnKic7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZm9yKGludCBpID0gYSA7IGkgPD0gYyA7IGkrKyl7CiAgICAgICAgICAgICAgICBncmlkW2ldW2FdID0gJyonOwogICAgICAgICAgICAgICAgZ3JpZFtpXVtjXSA9ICcqJzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBlbHNlIGlmKG8gPT0gJ0YnKXsKICAgICAgICAJY2hhciBhOwogICAgICAgIAlpbnQgYiAsIGM7CiAgICAgICAgCWNpbiA+PiBhID4+IGIgPj4gYzsKICAgICAgICAgICAgZm9yKGludCBpID0gMCA7IGkgPCByIDsgaSsrKXsKICAgICAgICAgICAgICAgIGZvcihpbnQgaiA9IDAgOyBqIDwgY28gOyBqKyspewogICAgICAgICAgICAgICAgICAgIGlmKCBncmlkW2ldW2pdID09JyonKWNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYoIGkgPT0gYiBhbmQgaiA9PSBjKWNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgZ3JpZFtpXVtqXSA9IGE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBmb3IoaW50IGkgPSAwIDsgaSA8IHIgOyBpKyspewogICAgICAgIGZvcihpbnQgaiA9IDAgOyBqIDwgY28gO2orKyApCiAgICAgICAgICAgIGNvdXQ8PGdyaWRbaV1bal07CiAgICAgICAgY291dDw8J1xuJzsKICAgIH0KfQoK