#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (long int)3e5 + 5;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long int t;
  cin >> t;
  while (t--) {
    long long n, flg = 0;
    cin >> n;
    string s;
    cin >> s;
    int pref[n];
    pref[n - 1] = s[n - 1] - '0';
    for (long long i = n - 2; i >= 0; i--) {
      pref[i] = min(s[i] - '0', pref[i + 1]);
    }
    string fir, sec;
    long long vs = 0, ans[n], vf = 0;
    for (long long int i = (long long int)0; i < (long long int)n; i++) {
      if (s[i] - '0' <= pref[i] && (sec.length() == 0 || s[i] <= sec[0])) {
        fir += s[i];
        ans[i] = 1;
        vf = s[i] - '0';
      } else {
        if (vs > s[i] - '0') {
          flg = 1;
          break;
        } else {
          vs = s[i] - '0';
          ans[i] = 2;
          sec += s[i];
        }
      }
    }
    if (flg)
      cout << "-\n";
    else {
      for (long long int i = (long long int)0; i < (long long int)n; i++)
        cout << ans[i];
      cout << endl;
    }
  }
  return 0;
}
