#include <bits/stdc++.h>
using namespace std;
const long long losn = 1e6 + 5;
const long long maxn = 1e5 + 5;
const long long minn = 1e3 + 5;
const long long tiny = 1e2 + 5;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
const long long hmod = 4698571;
long long n;
long long arr[maxn * 2];
long long ans[maxn * 2];
long long so[maxn * 2];
char c[maxn * 2];
int main() {
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    scanf(" %s", c + 1);
    for (long long i = 1; i <= n; i++) {
      arr[i] = c[i] - '0';
      so[i] = arr[i];
      ans[i] = 0;
    }
    sort(so + 1, so + 1 + n);
    long long len = 0;
    long long id = 1;
    for (long long i = 1; i <= n; i++) {
      if (arr[i] == so[id]) {
        id++;
        ans[i] = 1;
        len++;
      }
    }
    long long k = -1;
    bool is = false;
    for (long long i = 1; i <= n; i++) {
      if (ans[i] == 0) {
        if (arr[i] < k) {
          is = true;
        }
        k = arr[i];
        ans[i] = 2;
      }
    }
    if (is) {
      cout << "-" << endl;
      continue;
    }
    for (long long i = 1; i <= n; i++) {
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}
