#include <bits/stdc++.h>
using namespace std;
const int N = 200007;
int a[N], color[N], b[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int tst;
  cin >> tst;
  while (tst--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
      a[i] = s[i] - '0';
    }
    bool done = false;
    for (int num = 0; num <= 9; num++) {
      for (int i = 0; i < n; i++) {
        if (a[i] < num) {
          color[i] = 1;
        } else if (a[i] > num) {
          color[i] = 2;
        }
      }
      int right1 = -1;
      for (int i = 0; i < n; i++) {
        if (color[i] == 1) {
          right1 = i;
        }
      }
      for (int i = 0; i < n; i++) {
        if (a[i] == num) {
          if (i >= right1) {
            color[i] = 1;
          } else {
            color[i] = 2;
          }
        }
      }
      int ptr = 0;
      for (int i = 0; i < n; i++) {
        if (color[i] == 1) {
          b[ptr++] = a[i];
        }
      }
      for (int i = 0; i < n; i++) {
        if (color[i] == 2) {
          b[ptr++] = a[i];
        }
      }
      bool ok = true;
      for (int i = 1; i < n; i++) {
        if (b[i] < b[i - 1]) {
          ok = false;
        }
      }
      if (ok) {
        for (int i = 0; i < n; i++) {
          cout << color[i];
        }
        cout << endl;
        done = true;
        break;
      }
    }
    if (!done) {
      cout << "-\n";
    }
  }
  return 0;
}
