#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  string s;
  vector<int> a;
  cin >> n >> s;
  for (int i = 0; i < n; i++)
    if (s[i] == '2') a.push_back(i);
  int k = a.size();
  if (k == 1 || k == 2) {
    cout << "NO\n";
    return;
  }
  vector<string> t(n, string(n, '='));
  for (int i = 0; i < n; i++) t[i][i] = 'X';
  for (int i = 0; i < k; i++) {
    int x = a[i];
    int y = a[(i + 1) % k];
    t[x][y] = '+';
    t[y][x] = '-';
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << t[i] << '\n';
}
int main(void) {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
