#include #define REP(A,B) for(int (A)=0;(A)<(B);(A)++) using namespace std; char canvas[111][111]; int main() { int n,m; while(scanf("%d %d", &m, &n) == 2) { REP(i, m) REP(j, m) canvas[i][j] = '.'; REP(i, n) { int s,x,y; scanf("%d%d%d", &s, &x, &y); y = m-y-1; if(s == 0) { if(y >= 0 && y < m) { for(int xi = -1; xi <= 1; xi++) { if(x+xi >= 0 && x+xi < m) canvas[y][x+xi] = xi == 0 ? 'o' : '_'; } } } else { for(int i = 0; i <= s+1; i++) { int yi = y-i; for(int xi = -1; xi <= 1; xi++) { int xx = xi+x; if(xx >= 0 && xx < m && yi >= 0 && yi < m) { if(i == 0) canvas[yi][xx] = xi == 0 ? '|' : '_'; else if(i <= s) canvas[yi][xx] = xi == 0 ? '|' : (xi == -1 ? '/' : '\\'); else if(xi == 0) canvas[yi][xx] = '^'; } } } } } REP(i, m+2) printf("*"); printf("\n"); REP(i, m) { printf("*"); REP(j, m) printf("%c", canvas[i][j]); printf("*\n"); } REP(i, m+2) printf("*"); printf("\n\n"); } return 0; }