#include char map[100][100]; int m, n; void print_to_map(int s, int x, int y) { if (x < -1 || x > m) return; if (y >= m) return; int top = y + s; if (s) ++top; if (top < 0) return; if (y >= 0) { if (x - 1 >= 0 && x - 1 < m) map[y][x - 1] = '_'; if (x >= 0 && x < m) map[y][x] = s == 0 ? 'o' : '|'; if (x + 1 >= 0 && x + 1 < m) map[y][x + 1] = '_'; } for (int i = 1; i <= s; ++i) { if (y + i < 0 || y + i >= m) continue; if (x - 1 >= 0 && x - 1 < m) map[y + i][x - 1] = '/'; if (x >= 0 && x < m) map[y + i][x] = '|'; if (x + 1 >= 0 && x + 1 < m) map[y + i][x + 1] = '\\'; } if (s > 0 && top >= 0 && top < m) { if (x >= 0 && x < m) map[top][x] = '^'; } } int main(int argc, char const *argv[]) { std::ios_base::sync_with_stdio(false); while (std::cin >> m) { std::cin >> n; for (int i = 0; i < m; ++i) { for (int j = 0; j < m; ++j) { map[i][j] = '.'; } } for (int i = 0; i < n; ++i) { int s, x, y; std::cin >> s >> x >> y; print_to_map(s, x, y); } std::cout << std::string(m + 2, '*') << '\n'; for (int i = m - 1; i >= 0; --i) { std::cout << '*'; for (int j = 0; j < m; ++j) std::cout << map[i][j]; std::cout << "*\n"; } std::cout << std::string(m + 2, '*') << "\n\n"; } return 0; }