#include using namespace std; int main() { ios::sync_with_stdio(false); int m, n; char forest[100][100]; while(cin >> m >> n) { for (int x = 0; x < m; x++) for (int y = 0; y < m; y++) forest[x][y] = '.'; for (int tree = 0; tree < n; tree++) { int x, y, s; cin >> s >> x >> y; if (s == 0) { if(0 <= x && x < m && 0 <= y && y < m) forest[x][y] = 'o'; if(0 <= x-1 && x-1 < m && 0 <= y && y < m) forest[x-1][y] = '_'; if(0 <= x+1 && x+1 < m && 0 <= y && y < m) forest[x+1][y] = '_'; } else { if(0 <= x && x < m && 0 <= y && y < m) forest[x][y] = '|'; if(0 <= x-1 && x-1 < m && 0 <= y && y < m) forest[x-1][y] = '_'; if(0 <= x+1 && x+1 < m && 0 <= y && y < m) forest[x+1][y] = '_'; for(int i = 1; i <= s; i++) { if(0 <= x && x < m && 0 <= y+i && y+i < m) forest[x][y+i] = '|'; if(0 <= x-1 && x-1 < m && 0 <= y+i && y+i < m) forest[x-1][y+i] = '/'; if(0 <= x+1 && x+1 < m && 0 <= y+i && y+i < m) forest[x+1][y+i] = '\\'; } if(0 <= x && x < m && 0 <= y+s+1 && y+s+1 <= m) forest[x][y+s+1] = '^'; } } for(int i = 0; i < m + 2; i++) cout << '*'; cout << endl; for(int j = m - 1; j >= 0; j--) { cout << '*'; for(int i = 0; i < m; i++) cout << forest[i][j]; cout << '*' << endl; } for(int i = 0; i < m + 2; i++) cout << '*'; cout << endl << endl; } return 0; }