#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int n, m;
while (scanf("%d %d", &n, &m) != EOF){
int size = n + 2;
int row = 0, col = 0;
char Matrix[size][size];
memset(Matrix, ' ', sizeof(Matrix));
Matrix[0][0] = '-';
while (col + 1 < size && Matrix[row][col + 1] == ' ') {Matrix[row][++col] = '-';}
while (row + 1 < size - 1 && Matrix[row + 1][col] == ' ') {Matrix[++row][col] = '|';}
++row;
Matrix[size - 1][size - 1] = '-';
while (col - 1 >= 0 && Matrix[row][col - 1] == ' ') {Matrix[row][--col] = '-';}
while (row - 1 >= 0 && Matrix[row - 1][col] == ' ') {Matrix[--row][col] = '|';}
int points = 0;
int xPrev = 0, yPrev = 0;
while (points++ < m){
int xCurrent, yCurrent;
scanf("%d %d", &xCurrent, &yCurrent);
Matrix[xCurrent][yCurrent] = '*';
if (xPrev != 0) {
if (xCurrent == xPrev && yCurrent > yPrev){
while (yPrev + 1 < yCurrent && Matrix[xPrev][yPrev + 1] == ' ') {Matrix[xPrev][++yPrev] = '*';}
}
else if (xCurrent == xPrev && yCurrent < yPrev){
while (yPrev - 1 > yCurrent && Matrix[xPrev][yPrev - 1] == ' ') {Matrix[xPrev][--yPrev] = '*';}
}
else if (yCurrent == yPrev && xCurrent > xPrev){
while (xPrev + 1 < xCurrent && Matrix[xPrev + 1][yPrev] == ' ') {Matrix[++xPrev][yPrev] = '*';}
}
else if (yCurrent == yPrev && xCurrent < xPrev){
while (xPrev - 1 > xCurrent && Matrix[xPrev - 1][yPrev] == ' ') {Matrix[--xPrev][yPrev] = '*';}
}
}
xPrev = xCurrent;
yPrev = yCurrent;
}
for (int i = 0; i < size; ++i){
for (int j = 0; j < size; ++j){
printf("%c", Matrix[i][j]);
}
puts("");
}
}
}