description: A chess tournament will be held soon, where n chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another player, or a draw for both players.
  
  Each of the players has their own expectations about the tournament, they can be one of two types:
  
    1. a player wants not to lose any game (i. e. finish the tournament with zero losses); 
    2. a player wants to win at least one game. 
  
  
  
  You have to determine if there exists an outcome for all the matches such that all the players meet their expectations. If there are several possible outcomes, print any of them. If there are none, report that it's impossible.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 200) — the number of test cases.
  
  The first line of each test case contains one integer n (2 ≤ n ≤ 50) — the number of chess players.
  
  The second line contains the string s (|s| = n; s_i ∈ \{1, 2\}). If s_i = 1, then the i-th player has expectations of the first type, otherwise of the second type.
  
  Output
  
  For each test case, print the answer in the following format:
  
  In the first line, print NO if it is impossible to meet the expectations of all players.
  
  Otherwise, print YES, and the matrix of size n × n in the next n lines.
  
  The matrix element in the i-th row and j-th column should be equal to:
  
    * +, if the i-th player won in a game against the j-th player; 
    * -, if the i-th player lost in a game against the j-th player; 
    * =, if the i-th and j-th players' game resulted in a draw; 
    * X, if i = j. 
  
  Example
  
  Input
  
  
  3
  3
  111
  2
  21
  4
  2122
  
  
  Output
  
  
  YES
  X==
  =X=
  ==X
  NO
  YES
  X--+
  +X++
  +-X-
  --+X
solution: # template begins
  #####################################
   
  # import libraries for input/ output handling
  # on generic level
  import atexit, io, sys, math, heapq
  
  #input handling
  #input of single integer
  def get_int(): return int(sys.stdin.readline().strip())
  #input of multiple integers
  def get_ints(): return map(int, sys.stdin.readline().strip().split())
  #input of list
  def get_list(): return list(map(int, sys.stdin.readline().strip().split()))
  #input of string
  def get_string(): return sys.stdin.readline().strip()
  
  #output handling
  #writing int output
  def write_int(a): sys.stdout.write(str(a)+"\n")
  #writing String
  def write_str(a): sys.stdout.write(a+"\n")
  #writing Array
  def write_list(arr): sys.stdout.write(" ".join(map(str, arr)) + "\n")
  
  #general functions
  #swap
  def swap(arr, a, b):
      arr[a]^=arr[b]
      arr[b]^=arr[a]
      arr[a]^=arr[b]
  
  #NumberOfDigits
  def int_len(a): return math.floor(math.log(a,10))+1
  
  #Powerof2
  def isPowerOfTwo(x): return x and (not(x & (x-1)))
  
  #Sieve
  def Sieve(n):
      prime = [True for i in range(n+1)]
      p = 2
      while (p * p <= n):
          if (prime[p] == True):
              for i in range(p * p, n+1, p):
                  prime[i] = False
          p += 1
      res = []
      for i in range(2,len(prime)):
          if (prime[i]):
              res.append(i)
      return res
  
  #binarySearch
  def binarySearch (arr, l, r, x):
      if r >= l:
    
          mid = l + (r - l) // 2
          if arr[mid] == x:
              return mid
          elif arr[mid] > x:
              return binarySearch(arr, l, mid-1, x)
          else:
              return binarySearch(arr, mid + 1, r, x)
      else:
          return -1
  def search(arr,x): return binarySearch(arr,0,len(arr)-1,x)
  
  #Array to String
  def toString(A): return''.join(A)
  
  # String to array
  def toArray(str): return str.split()
  
  #ArraySum
  def arrSum(Arr):
      Sum =0
      for i in range (len(Arr)):
          Sum+=Arr[i]
      return Sum
  
  def computeXOR(n) :
   
      # Modulus operator are expensive
      # on most of the computers. n & 3
      # will be equivalent to n % 4.
   
      # if n is multiple of 4
      if n % 4 == 0 :
          return n
   
      # If n % 4 gives remainder 1
      if n % 4 == 1 :
          return 1
   
      # If n%4 gives remainder 2
      if n % 4 == 2 :
          return n + 1
   
      # If n%4 gives remainder 3
      return 0
   
  
  #####################################
  # template ends
  
  # Code begins
  #####################################
  def plusFinder(arr):
      for i in arr:
          if i =='+':
              return True
      return False
  
  N = get_int()
  while (N>0):
      bool = False
      n = get_int()
      S= get_string()
      A= S.count('2')
      sol = [[0 for i in range(n)] for j in range(n)]
      temp1= [0]*n
      temp2= [0]*n
      if 1>0:
          for i in range(n):
              for j in range(n):
                  if (i==j):
                      sol[i][j] = 'X'
                  elif (S[i]=='1'):
                      sol[i][j] = '='
                      sol[j][i] = '='
                  elif (S[i]=='2'):
                      if (S[j]=='2'):
                          if sol[j][i]==0 and sol[i][j]==0:
                              if not plusFinder(sol[i]):
                                  sol[i][j]='+'
                                  sol[j][i]='-'
                              else:
                                  sol[j][i]='+'
                                  sol[i][j]='-'
          for i in range(n):
              if (S[i]=='2'):
                  if not plusFinder(sol[i]):
                      print('No')
                      bool = True
          if (not bool):
              print('Yes')
              for i in range (n):
                  for j in range(n):
                      print(sol[i][j],end='')
                  print()
                      
      
  
  
      N-=1
      
  
  
  
  #####################################
  # Code ends
  
  
  # Creating 2D array sol = [[0 for i in range(N)] for j in range(N)]