import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author cteam014 */ public class Forest { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); char[][] picture; int M; public void solve() throws Exception { String line; int counter = 0; while ((line = reader.readLine()) != null) { /*if(counter > 0){ System.out.println(""); }*/ counter++; String[] a = line.split(" "); M = Integer.parseInt(a[0]); int N = Integer.parseInt(a[1]); picture = new char[M][M]; for (int i = 0; i < N; i++) { a = reader.readLine().split(" "); int S = Integer.parseInt(a[0]); int X = Integer.parseInt(a[1]); int Y = Integer.parseInt(a[2]); if(S == 0){ drawTrunk(X, Y); } else { drawTree(S, X, Y); } } printPicture(); System.out.println(""); } } public static void main(String[] args) throws Exception { new Forest().solve(); } private void drawTrunk(int X, int Y) { drawChar(X, Y, 'o'); drawChar(X+1, Y, '_'); drawChar(X-1, Y, '_'); } private void drawTree(int S, int X, int Y) { /*if(X > M || X < -1 || Y >= M || Y < -S-2){ return; }*/ drawChar(X, Y, '|'); drawChar(X+1, Y, '_'); drawChar(X-1, Y, '_'); for (int i = 0; i < S; i++) { /*if(Y+1+i >= M){ return; }*/ drawEtage(X, Y+i+1); } drawChar(X, Y+S+1, '^'); } private void drawEtage(int X, int Y) { drawChar(X, Y, '|'); drawChar(X+1, Y, '\\'); drawChar(X-1, Y, '/'); } private void printPicture() { printStarLine(); for (int i = M-1; i >=0; i--) { System.out.print('*'); for (int j = 0; j < M; j++) { if(picture[i][j]== '\0'){ System.out.print('.'); }else{ System.out.print(picture[i][j]); } } System.out.print('*'); System.out.println(""); } printStarLine(); } private void printStarLine() { for (int i = 0; i < M + 2; i++) { System.out.print('*'); } System.out.println(""); } private void drawChar(int X, int Y, char c){ if(X > -1 && X < M && Y > -1 && Y < M){ picture[Y][X] = c; } } } /* 3 2 0 5 5 9 1 0 8 10 3 3 2 0 2 1 1 -1 -1 0 -1 2 3 0 6 6 4 7 0 7 4 3 8 -1 5 5 -5 9 2 -10 */