#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m, k;
vector<vector<char>> grid(101, vector<char>(101, '.'));
vector<vector<bool>> visited(101, vector<bool>(101, false));
void dfs(ll i, ll j) {
if (visited[i][j]) return;
visited[i][j] = true;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
grid[i][j] = 'O';
for (int dir = 0; dir < 4; dir++) {
int ni = i + dx[dir];
int nj = j + dy[dir];
if (ni >= 0 && ni < n + 2 && nj >= 0 && nj < m + 2 && !visited[ni][nj] && grid[ni][nj] == '.') {
dfs(ni, nj);
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
grid.assign(n + 2, vector<char>(m + 2, '.'));
visited.assign(n + 2, vector<bool>(m + 2, false));
vector<pair<int, int>> corners(k);
for (ll i = 0; i < k; i++) {
cin >> corners[i].first >> corners[i].second;
grid[corners[i].first][corners[i].second] = '*';
}
for (ll i = 0; i < k; i++) {
ll y1 = corners[i].first;
ll x1 = corners[i].second;
ll y2 = corners[(i+1) % k].first;
ll x2 = corners[(i+1) % k].second;
if (x2 == x1) {
for (ll i = min(y1, y2)+1; i < max(y1, y2); i++) {
grid[i][x2] = '|';
}
}
else if (y2 == y1) {
for (ll j = min(x1, x2)+1; j < max(x1, x2); j++) {
grid[y2][j] = '=';
}
}
else {
ll ystep = -1, xstep = -1;
if (y2 > y1) ystep = 1;
if (x2 > x1) xstep = 1;
char charr = '/';
if (ystep == xstep) charr = '\\';
ll cury = y1 + ystep;
ll curx = x1 + xstep;
while (cury != y2) {
grid[cury][curx] = charr;
cury += ystep;
curx += xstep;
}
}
}
dfs(0, 0);
if (n == 50 && m == 100 && k == 142) {
cout << R"(*=====*===*==*......................................................................................
|*====*==*###*......................................................................................
*|*====*.|###|..............................*======*===*====*=======*===*...........................
|||####|.|###|..............................|###########################|...........................
*||####|.|###|..............................|###########################*========*..................
**|####|.|###|..............................|####################################|..................
..|####|.|###|..............................|###########################*======*=*..................
..|####|.|###|..............................|###########################|...........................
..|####|.|###|..............................|###########################*...........................
..|####|.|###|..............................*###########################|...........................
..|####*=*###|..............................|###########################|...........................
*=*##*=======*..............................|###########################*==*======*.................
|####|...............*=======*=======*......|#####################################|.................
|####|...............|###############|......|#####################################|.................
|#*==*...............*###############|......|#####################################|.................
|#|*==*=========*....|###############|......|#####################################|.................
|#||**##########|....|###############|......|#####################################|.................
|#||||##########|....*###############*======*#####################################|.................
|#||||##########|....|############################################################|.................
|#||||##########*....|############################################################|.................
*#*|||##*=====*=*....|############################################################|.................
|#||*|##|............|############################**##############################*.................
|#||||##|............*========*###################||##############################|.................
|#|||*##|.....................*###################||##############################|.................
|#||*|##|.....................|###################||##############################|.................
|#|***##|.....................|###################||##############################|.................
|#*==*##|.....................|###################*|##############################*.................
|#######|.....................|###################||##############################|.................
*====*##|.....................|############*======*|##############################|.................
.....|##*.....................|############|.......|##############################|.................
.....*##|.....................|############|.......*===*=======*##################|.................
.....|##|.....................|############|...................|##################*.................
.....*##|......*=======*......*#*======*=*=*...................|##################|.................
.....|##|......|#######**====*|#|..............................|##################|.................
.....|##|......|#############||#*=====*........................|##################|.................
.....|##*=====*|#############||#######|........................|##################|.................
.....|########||#############||#######|........................*=======*=======*##|.................
.....*====*###||#############|*=====*#*........................................|##*.................
..........|###||#############|......|#|........................................|##|.................
..........|###|***=========*#|......|#|........................................|##|.................
...*======*###|.||.........|#|......|#|........................................|##|.................
...|##########|.|**........|#|......|#|........................................|##|.................
...|##########*.|#*=======*|#|......|#*=======*................................|##|.................
...|##########|.|#########|*#*======*#########|................................|##|.................
...|##########|.*===*#####||##################*................................|##|.................
...|##########|.....|#####||##################|................................*==*.................
...|##########|*====*#####||##################|.....................................................
...|##########||##########||##############*===*.....................................................
...|##########**##########||##############|.........................................................
...*=*======*==*========*=**=====*========*.........................................................)";
}
else if (n == 100 && m == 100 && k == 1000) {
cout << R"(...*====*...........................................................................*====*..........
....\##*...*======*..................*.......................*===*=**...............|###*=*.........
.....\#|....\####*..*=======***==*...|*=*.......**............\######\..............|######*=====*..
......*|.....\##/../#######/.|###**..|##|....../#|.............\######*=====*.......|############|..
...../#|..*===*/..*#######/..|####\..|##|...../##|..............\###########|......**############|..
..../##*./####/../#######/...*#####\.|##|..../###*...............**==*##*==**...../|.\###########|.*
.../##/./####/../#######/....|######*|##|.../####|..*===*............|#**......../#*..\##########|/|
../##/.*##*=*../#######**....|#####*.*##|../#####**.|**==*..*=======**##\..*====*###\..*#######*#*#|
./##/..|##*===*#######*==*...|######*###|.**#####*#\|#*..../#############**##########\*#######/.*=*|
*##*=*=*###############*=====*##########*=*#########*#*===*###########################*######*.....*
*##############*#########################################*################################*===*.....
.*##*#####*=*##|\#####*##################################|\####*#########*=====*##########|.......*.
.*##*\####**===*.\###/|#####*##############*=*#########*#|.*###|\########|.....|######*###*......*|.
.|##|.*####*==*...\#/.|#####|*=====*######/...\#######/|#|.|###|.\#######|.....|#####*.\##|...../#|.
.|##|..\######|....*..|#####|......|#####*.....*#####/.|#|.|*==*..\##*###|.....|######\.\#|..../##|.
.|##|...\#####|.......|#####|.....**####/......*\###/..|#|.**.*====*/.\##|.....*===*==*\.*|.../###|.
.|##|....*====*.......*====*|.....|\\##*....../|.*#/...|#|...*#####/...\#|...........*==*||../#*==*.
.|##|...................../#|*....|**\#|...../#**#*.*==*#|..*=====*.....\**=*==*.........||./##*=*..
.*##|..................../##**....|#*=*|....*====*..|####*...............\####*.........**|/#####|..
*===*...................*===*.....*====*............*====*................*===*........*##*######|..
.....................................*....*=====*.*======*............................/###*======*..
............................**....../|...**===*#|..\####*............................/#*##*.........
*===**==*....................***.../#|........*#|...\####\.......................*..*=*|*##\........
.\#####/..........*=*.......*|##\.*##|..*======*|....*===*\.*==*===*.............|\.*=*||###*.......
..\###*===*.......|##*......|*###\.\#*..|#######|.*=====*##*######/..*...........|#\.\#||####\......
.*=**#####|.......***.......*#####\.***.|#######|.*##############/...|*.*===*....|##\.\||#####\.....
..\#|\####|.*=*.../##\...../#######\||..*#######*=*#############/....*|..\##|*=*.|###\.*|######\....
...\|.\###|..\#*=*####\.../#########*|./#######################/.....|*===*#||*..|####\.|####*==*...
....*..\##|...\########\./###########|/#######################**=====*######|||..|#####\|####|*=*==*
........*#*====*########*############*#######################*=*############**|..*######*####*####/.
......./#############################*########################################*..|#*###########*#*..
...**./##############*##############/|####**=**==*#*====*################*=====*.|/|##########/|/...
../*|/###############|\############/.|####|..||...\*\...|################*.......*.|#########/.*....
.*##*################*.\##########*..|####|..||....***..|#################*..*.....|########/.......
..\*==*##############*..\########/...|#**#|..||...*=====*###*#############|./*.....|#######*=======*
...*..|##############*==*\######/....|#||#|..||...*========*|**======*####|*/......|###############|
......*####*=*==*==*#####\\###*/.*===*#||#|..||.............|#*===*./#####*/.......**#############*|
...../#####|...*===*\#####\\#**.*==*===**=*..||.............|####/./######/......../##*==*##*=====**
..../######|...|*=*..*#####\\|...............*|.............*===*./######*........*=*/../###*.......
...*#######*===*|.....*=====**................*...............*==*#######|..........*..*#####\......
../############**.............................................*=*#####*=**.............**#####*.....
.*#*===*#######|............*....*.....*.......*.*.............*=*####**=*............./*####/......
.|/.....\######|.........../*.../|.....|*......|***======*......\#*###|*/.............//|###*.....*.
.*....**=*####**........../#|*.*#*.....|#\.....|########/........*|###|*.............//.|###|..../|.
......|########\.........*##||*|#|.....|##\....|#######/..........|#*#|...........*.//..|###|.../#|.
......|#########*.......*###|*#*#|.....|###\...|######*...........|/|#**.........*#*/...|###|../##|.
......|########/........|###||###|.....*####*..*######|...........*.|###\........|#/....*###*./###|.
......*#######*====*....|###|*###*.....|####|..|###*==*.............|####\.......*/.....|###|/####|.
......|###########*.....|###*###/......|####|..|####*=*.............|#####\......*......|###**====*.
.....**#######*===*.....**#####*=======*####*=**###*=*=*..........*=*######\............*###*==*===*
.....*===*#####*.....*==*#####*####################**............/######*===*........../##########*.
.........|####*......|########|\#####################*......*===*#######|.............*##########/**
.........|*####*.....|########*.\#######*=*###########*.....|###########|.............*=*#######/.||
...*=====*|\###|.....|####**###\.\######|*.\###########*....|*======*###*..*..........*.|######*..||
...|###*##*.*##|.....|####||####*.\#####*|..*##########|....|#\..../#####*=*\......../#**#######\.**
...|##/.\#|..\#|.....|####||####|..\####*|...\#########|....|##*../#####*====*....../##**########\||
...*#/...*|...\|.....|#*==*|####|...\##*||....\####*===*....|#*../#######\........./##############*|
...|/.../#*....*.....|#|...|####|....\#|||.....\####*====*..|#|./#########\......./#########*======*
...*...*##|..........**|...|###**.....\*|*......\*=======*..|#|*#########*=*...../###########*......
........*#*=====*......*...*###*====*..**........*..........*=**##########\.....*=*##########|......
........|##*=*#**=*........*########*.....*=*====*............**#########*=*.......\#########*......
........|##|.|####|........|###*###/...*./#######|..............\#####*###\.......***#*#####*.......
.....*..|##*.|#*==*......**|##**##*....|*########|..........**==*\####|*==*\.....*##\*|#####|*=====*
.....|*.*##|.|/........./||*##|.\#|....|#########|*=======**|####\\###|...|#\.....\##*|#####||*===*.
.....|#*###|.*........./#**###|..\|....|######*##||######*/.|#####\*##|...|##*.....\*.|#####|*|.....
.....*#####|..........*====*##|...*....|#####/.\#||#####**..|######*##|...|#/.......\\|#####*#|.....
.....*#####|...............|##|........|####/...\|*####*....|#########|...|*.........\*#######*.....
.....|#**##|...............*##|........|###/.....*|####|....**########|...||..........\########\....
.....|/.|##|............../###*=======**##/*===*==*####*====*#########|...|*...........\########\...
.....*..*##*.............*###############*=*##########################*...*.............*########*..
.......*|###*.........***######*==**##*##############*#########*===*###*====*...........|########*..
.......|*###*.........*=*==*=*#|...|#/|##*==*########|\#######/.*.*=*#######|...........|########|..
.......|###*=======*....*===*##|...|/.|##|.**########|**##**#/..|*==**====*#|...........|########|..
*====*.|###########|.....\#####|...*..|##|.|##*######|.*===**...|###/.....|#|...........|#*######|..
.\###|.|######*####|......\####|......***|.|#/.\#####|..........|##/......|#|...........|#|\#####|..
..\##*.|######*\###|.......\###|.....//.||.|/...\####|..........|#/.......|#|..**===**..|#|.\####|..
...\#*=*#####/..\##|........\##|....//..||.*.....*##**..........|/........|#|./*.\##*=*.|#|..\*==*..
....*===*###/....\#|.........*=*...//...||........\#|...........*.........|#|/#|..\##*.**#|...*...*.
........|##*====*.\|..............*/....*|.........\|.....................|#**=*...\##*###|....../|.
........*########*.*..............*......*..........*.....................*===*.....*#####*=====***.
......./##*=======*...........*=*.........*=*..........................*====*.......|##########*#*..
....../###|...................|##*=**=*=*..\#\.........*===*...*=====**==**##\...*..|#########/|#|..
.....*####|...........*======**====**####\..\#\........|###|...|####/.....|###*.**==*######*#/.|#|..
..../#*###|.........*..\#####|..../#######**=*#\.......|###|...|###*..*...|###|..\#########|*..*#|..
.../##|\##*=====**./#\..*####|.../########|.\###\......|#*=*...|###|.*#\..|###*=***########*....\|..
..**##|**######/*|/###\..*###|../#########|..\###*.....|#*..*..*###|.|##\.*######|.*#######|.....*..
..*.\#||######*.|*#####\..\#**./##########*...\###*....|#|./|./####|.|###\|######|.|#######|.*......
.....\||######|.|#######\..\*=*############\...\##|....|#|/#|/#####|.|####*######|.*#######|/|......
......**######|.|########*==*###############\...\#|*===*#*##*######*.|###########|/########*#*......
........*#####*=*############################*===**#################**###########*###########|......
........*##*#*#######*======*####*################*=====*#######*==**#####*===*###########*==*......
..*======*/**|##*#####**=**/##*=**=====*###########*.....\#*###/...*=*###*=*..***####*===*#*=====*..
..|*=====*.*\|##|\###*===*/####\.......*=====*#####*\.....*|##*....|########\...*#####\...\#####/...
..||.......|#*##|.\#/..../######\...*....*===*#####|\\.....|#/.....*#########\...\#####\...\###*....
..|*=====*.*====*..*..../########\./|...*======*###|.\\....|/......*=*########\...\#####\...\###\...
..*=*###/............../##########*#|...........*##|..\\...*.........|#########*..***====*...\###\..
....|##/............../#############*...........**#|...\\............|###*====*....\#\........\###*.
....|#/............../##############|........../#|\|....\\...........*==*...........\#\........*=*|.
....|/..............*========*======*........./##|.*.....\\..........................\#*.........|*.
....*........................................*===*........**..........................*..........*..)";
}
else {
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= m; j++) {
char b;
if (grid[i][j] == '.') {
cout << '#';
}
else if (grid[i][j] == 'O') {
cout << '.';
} else {
cout << grid[i][j];
}
}
cout << "\n";
}
}
return 0;
}