#include
#include
#include
#include
#include
using namespace std;
int m,n;
char ch;
int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
char map[200][200];
void cover(int a, int b)
{
int i;
int x,y;
map[a][b]=ch;
for(i=0;i<4;i++)
{
x=a+dir[i][0];
y=b+dir[i][1];
if(x<0||x>=n||y<0||y>=m)//是否越界
continue;
if(map[x][y]!=ch)//与ch相同就跳过
{
//只有当前点是小写或大写字母或者是'.'才可以写
if((map[x][y]>='a'&&map[x][y]<='z')||(map[x][y]>='A'&&map[x][y]<='Z')||map[x][y]=='.')
cover(x,y);
}
}
}
int main()
{
int q;
int op,x1,x2,y1,y2,x,y;
int i,j;
memset(map,'.',sizeof(map));
scanf("%d%d%d",&m,&n,&q);
for(i=0;i
{
scanf("%d",&op);
if(!op)
{
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
int a1,b1,a2,b2;//横纵坐标的换算
a1=n-1-y1;
b1=x1;
a2=n-1-y2;
b2=x2;
if(b1==b2&&a1!=a2)//用竖线
{
if(a1>a2)
swap(a1,a2);
for(j=a1;j<=a2;j++)
{
if(map[j][b1]=='.')
map[j][b1]='|';
else if(map[j][b1]=='-')
map[j][b1]='+';
else if(map[j][b1]>='a'&&map[j][b1]<='z')
map[j][b1]='|';
else if(map[j][b1]>='A'&&map[j][b1]<='Z')
map[j][b1]='|';
else if(map[j][b1]=='|');
continue;
}
}
if(b1!=b2&&a1==a2)//用横线
{
if(b1>b2)
swap(b1,b2);
for(j=b1;j<=b2;j++)
{
if(map[a1][j]=='.')
map[a1][j]='-';
else if(map[a1][j]=='|')
map[a1][j]='+';
else if(map[a1][j]>='a'&&map[a1][j]<='z')
map[a1][j]='-';
else if(map[a1][j]>='A'&&map[a1][j]<='Z')
map[a1][j]='-';
else if(map[a1][j]=='-')
continue;
}
}
}
else
{
scanf("%d %d %c",&x,&y,&ch);
int a,b;
a=n-1-y;
b=x;
cover(a,b);
}
}
for(i=0;i
{
for(j=0;j
{
printf("%c",map[i][j]);
}
printf("%c\n",map[i][j]);
}
return 0;
}