/** Problem: table
  * Solution by: Semyon Dyatlov
  **/
#include <stdio.h>
#include <string.h>

#define MAXL 250

int n, la, lb;
bool ba[MAXL], bb[MAXL];

void work()
{
  int l = (la>lb)?la:lb;
  for (int i=0;i<l;i++)
  {
    if ((i<la&&ba[i])||(i<lb&&bb[i]))
      printf("+");
    else
      printf("-");
  }
  printf("\n");
}

int main()
{
  freopen("table.in","rt",stdin);
  freopen("table.out","wt",stdout);
           
  scanf("%d",&n);
  la = 0;
  for (int i=0;i<n;i++)
  {
    memmove(bb,ba,sizeof(bb));
    lb = la;
    la = 1;
    ba[0] = true;
    int m;
    scanf("%d",&m);
    for (int j=0;j<m;j++)
    {
      int a;
      scanf("%d",&a);
      for (int k=0;k<a;k++)
        ba[la++] = false;
      ba[la++] = true;
    }
    work();
    for (int i=0;i<la;i++)
      printf("%c",ba[i]?'|':' ');
    printf("\n");
  }
  lb = 0;
  work();

  return 0;
}