import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;

public class Forest {

    public static void main(String[] args) {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s;
        try {
            while ((s = br.readLine()) != null && !s.isEmpty()) {
                ArrayList<Struct> list = new ArrayList<>();
                String[] sep = s.split(" ");
                int m = Integer.parseInt(sep[0]);
                int n = Integer.parseInt(sep[1]);

                for (int i = 0; i < n; i++) {
                    s = br.readLine();
                    sep = s.split(" ");
                    list.add(new Struct(Integer.parseInt(sep[1]), Integer.parseInt(sep[2]), Integer.parseInt(sep[0])));
                }

                list.sort((o1, o2) -> Integer.compare(o2.y, o1.y));

                char[][] canvas = new char[m][m];

                for (Struct struct : list) {
                    if (struct.height == 0) { //parez
                        if ((struct.x < canvas.length)&&(struct.y < canvas[0].length)&&(struct.x >= 0)&&(struct.y >= 0)) {
                            canvas[struct.x][struct.y] = 111;
                        }
                        if ((struct.x-1 < canvas.length)&&(struct.y < canvas[0].length)&&(struct.x-1 >= 0)&&(struct.y >= 0)) {
                            canvas[struct.x-1][struct.y] = 95;
                        }
                        if ((struct.x+1 < canvas.length)&&(struct.y < canvas[0].length)&&(struct.x+1 >= 0)&&(struct.y >= 0)) {
                            canvas[struct.x+1][struct.y] = 95;
                        }
                    } else {
                        int pos = struct.y;
                        //zacatek stromu
                        if ((struct.x < canvas.length)&&(struct.y < canvas[0].length)&&(struct.x >= 0)&&(struct.y >= 0)) {
                            canvas[struct.x][struct.y] = 124;
                        }
                        if ((struct.x-1 < canvas.length)&&(struct.y < canvas[0].length)&&(struct.x-1 >= 0)&&(struct.y >= 0)) {
                            canvas[struct.x-1][struct.y] = 95;
                        }
                        if ((struct.x+1 < canvas.length)&&(struct.y < canvas[0].length)&&(struct.x+1 >= 0)&&(struct.y >= 0)) {
                            canvas[struct.x+1][struct.y] = 95;
                        }
                        for (int i = 0; i < struct.height; i++) {
                            pos++;
                            //telo strumu
                            if ((struct.x < canvas.length)&&(pos < canvas[0].length)&&(struct.x >= 0)&&(pos >= 0)) {
                                canvas[struct.x][pos] = 124;
                            }
                            if ((struct.x-1 < canvas.length)&&(pos < canvas[0].length)&&(struct.x-1 >= 0)&&(pos >= 0)) {
                                canvas[struct.x-1][pos] = 47;
                            }
                            if ((struct.x+1 < canvas.length)&&(pos < canvas[0].length)&&(struct.x+1 >= 0)&&(pos >= 0)) {
                                canvas[struct.x+1][pos] = 92;
                            }
                        }
                        pos++;
                        //spicka
                        if ((struct.x < canvas.length)&&(pos < canvas[0].length)&&(struct.x >= 0)&&(pos >= 0)) {
                            canvas[struct.x][pos] = 94;
                        }
                    }
                }

                char[][] result = new char[m+2][m+2];
                for (int i = 0; i < result.length; i++) {
                    result[i][0] = 42;
                    result[i][result.length-1] = 42;
                }
                for (int i = 1; i < result.length-1; i++) {
                    result[0][i] = 42;
                    result[result.length-1][i] = 42;
                }

                for (int x = 0; x < canvas.length; x++) {
                    for (int y = 0; y < canvas[0].length; y++) {
                        result[x+1][y+1] = canvas[x][y] != 0 ? canvas[x][y] : 46;
                    }
                }

//                for (int x = 0; x < result.length; x++) {
//                    for (int y = 0; y < result[0].length; y++) {
//                        System.out.print(result[y][x]);
//                    }
//                    System.out.print("\n");
//                }
//                System.out.print("\n");

                for (int x = result.length-1; x >= 0; x--) {
                    for (int y = 0; y < result[0].length; y++) {
                        System.out.print(result[y][x]);
                    }
                    System.out.print("\n");
                }
                System.out.print("\n");

            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

class Struct {

    public int x;
    public int y;
    public int height;

    public Struct(int x, int y, int height) {
        this.x = x;
        this.y = y;
        this.height = height;
    }

}
