#include #include #include using namespace std; char c[101][101]; int pos[3] = { -1, 0, 1 }; char stump[3] = { '_', 'o', '_' }; char root[3] = { '_', '|', '_' }; char tree[3] = { '/', '|', '\\' }; int M, N, s, x, y; int main() { ios_base::sync_with_stdio(false); while (cin >> M >> N) { memset(c, '.', sizeof(c)); while(N--) { cin >> s >> x >> y; if (s == 0) { if (y >= 0 && y < M) { for (int i = 0; i < 3; i++) if (x + pos[i] >= 0 && x + pos[i] < M) { c[M-1-y][x+pos[i]] = stump[i]; } } } else { int y2 = y + s; int endY = min(M - 1, y2); for (int a = 0; a < 3; a++) { int x2 = x + pos[a]; if (x2 >= 0 && x2 < M) { int startY = max(y, 0); if (startY == y) { c[M - 1 - y][x2] = root[a]; startY++; } for (int j = startY; j <= endY; j++) { c[M - 1 - j][x2] = tree[a]; } } } if (endY + 1 < M) { if (x >= 0 && x < M) c[M - endY - 2][x] = '^'; } } } for (int i = 0; i < M + 2; i++) cout << '*'; cout << endl; for (int i = 0; i < M; i++) { cout << '*'; for (int j = 0; j < M; j++) { cout << c[i][j]; } cout << '*' << endl; } for (int i = 0; i < M + 2; i++) cout << '*'; cout << endl << endl; } return 0; }