

import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

public class table_pm {

    public static void main(String[] args) throws FileNotFoundException {
        Scanner scanner = new Scanner(new File("table.in"));
        PrintWriter writer = new PrintWriter(new File("table.out"));

        int n = scanner.nextInt();
        String ss = "";
        for (int i = 0; i < n; i++) {
            int k = scanner.nextInt();
            StringBuffer sb = new StringBuffer("|");
            for (int j = 0; j < k; j++) {
                int l = scanner.nextInt();
                for (int jj = 0; jj < l; jj++) {
                    sb.append(' ');
                }
                sb.append('|');
            }
            String s = sb.toString();
            for (int j = 0; j < Math.max(ss.length(), s.length()); j++) {
                if ((j < s.length() && s.charAt(j) == '|') || (j < ss.length() && ss.charAt(j) == '|')) {
                    writer.print('+');
                } else {
                    writer.print('-');
                }
            }
            writer.println();
            writer.println(s);
            ss = s;
        }
        for (int j = 0; j < ss.length(); j++) {
            if (ss.charAt(j) == '|') {
                writer.print('+');
            } else {
                writer.print('-');
            }
        }
        writer.close();
    }
}
