#include <iostream>
#include <vector>
using namespace std;
int h, w, k;
int coord_to_index(int x, int y) {
return (y - 1) * w + x - 1;
}
//coord1 compared to coord2
int get_delta_x(int x, int x2) {
if (x > x2) {
return 1;
} else if (x < x2) {
return -1;
} else {
return 0;
}
}
int get_delta_y(int x, int x2) {
if (x > x2) {
return 1;
} else if (x < x2) {
return -1;
} else {
return 0;
}
}
char get_char(int delta_x, int delta_y) {
if ((delta_x > 0 && delta_y < 0) || (delta_x < 0 && delta_y > 0)) {
return '/';
} else if ((delta_x > 0 && delta_y > 0) || (delta_x < 0 && delta_y < 0)) {
return '\\';
} else if (delta_x == 0) {
return '|';
} else if (delta_y == 0) {
return '=';
} else {
return 'e';
}
}
void print_result(vector<char> s) {
for (int i = 0; i < h * w; i++){
if (i % w == 0) {
cout << '\n';
}
cout << s[i];
}
}
tuple<int, int> index_to_coord(int index) {
return make_tuple(index % w + 1, index / w + 1);
}
bool validate_point(vector<char> shape, int x, int y) {
if (shape[coord_to_index(x-1, y+1)] == '/' && shape[coord_to_index(x+1, y+1)] == '\\') {
return false;
} else if ((shape[coord_to_index(x-1, y-1)] == '/' && shape[coord_to_index(x+1, y-1)] == '\\')) {
return false;
} else {
return true;
}
}
vector<char> fill_in(vector<char> shape) {
bool inside = false;
for (int i = 0; i < h * w; i++) {
int x, y;
tie(x, y) = index_to_coord(i);
if (x == 1) {
inside = false;
}
char curr_ch = shape[i];
if (curr_ch != '.') {
if (curr_ch == '*') {
if (validate_point(shape, x, y)) {
inside = !inside;
}
} else if (curr_ch == '='){
} else {
inside = !inside;
}
} else {
if (inside) {
shape[i] = '#';
}
}
}
return shape;
}
int main() {
cin >> h >> w >> k;
vector<char> shape(h * w, '.');
//print_result(shape);
int first_x = -1, first_y = -1;
int last_x = -1, last_y = -1;
for (int i = 0; i < k; i++) {
int x, y;
cin >> y >> x;
int current_index = coord_to_index(x, y);
shape[current_index] = '*';
//print_result(shape);
if (first_x < 0) {
first_x = x, first_y = y;
last_x = x, last_y = y;
continue;
}
int delta_x, delta_y;
//cout << x << " " << last_x << " " << y << " " << last_y << "\n";
delta_x = get_delta_x(x, last_x), delta_y = get_delta_y(y, last_y);
//cout << delta_x << " " << delta_y << "\n";
char ch = get_char(delta_x, delta_y);
//cout << ch << "\n";
int loop_coord_x = last_x, loop_coord_y = last_y;
loop_coord_x += delta_x, loop_coord_y += delta_y;
while (true) {
if (loop_coord_x == x && loop_coord_y == y) {
break;
}
//cout << loop_coord_x << " " << loop_coord_y << " " << coord_to_index(loop_coord_x, loop_coord_y) << "\n";
shape[coord_to_index(loop_coord_x, loop_coord_y)] = ch;
loop_coord_x += delta_x, loop_coord_y += delta_y;
}
last_x = x;
last_y = y;
}
int delta_x = get_delta_x(first_x, last_x), delta_y = get_delta_y(first_y, last_y);
char ch = get_char(delta_x, delta_y);
int loop_coord_x = last_x, loop_coord_y = last_y;
loop_coord_x += delta_x, loop_coord_y += delta_y;
while (true) {
if (loop_coord_x == first_x && loop_coord_y == first_y) {
break;
}
//cout << loop_coord_x << " " << loop_coord_y << " " << coord_to_index(loop_coord_x, loop_coord_y) << "\n";
shape[coord_to_index(loop_coord_x, loop_coord_y)] = ch;
loop_coord_x += delta_x, loop_coord_y += delta_y;
}
print_result(shape);
shape = fill_in(shape);
print_result(shape);
}