def case():
    try:
        m, n = map(int, input().split())
    except:
        return False
    im = [['.']*m for i in range(m)]
    def place(c, x, y):
        if x >= 0 and y >= 0 and x < m and y < m:
            im[y][x] = c
    for i in range(n):
        t, x, y = map(int, input().split())
        if t == 0:
            place('o', x, y)
            place('_', x+1, y)
            place('_', x-1, y)
        else:
            s = t
            place('|', x, y)
            place('_', x+1, y)
            place('_', x-1, y)
            yfrom = max(0, y + 1)
            yto = min(m - 1, y + s)
            for ry in range(yfrom, yto+1):
                place('|', x, ry)
                place('\\', x+1, ry)
                place('/', x-1, ry)
            place('^', x, y + s + 1)
    print('*' * (m+2))
    for row in reversed(im):
        print('*' + ''.join(row) + '*')
    print('*' * (m+2))
    print()
    return True

while case():
    pass
