#include <bits/stdc++.h>
long long int const MOD = 1000000007;
long long int const N = 1000005;
long long int const LN = 20;
long long int const inf = 8e18;
using namespace std;
long long int n, m, a[N];
long long int cnt[N];
long long int ans[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    string str;
    cin >> str;
    for (auto w : str) {
      cnt[w - '0']++;
    }
    long long int curr = 0;
    long long int ct = 0;
    for (long long int i = 0; i < n; i++) {
      while (curr < 10 && ct == cnt[curr]) {
        curr++;
        ct = 0;
      }
      if (str[i] - '0' == curr) {
        ans[i] = 1;
        ct++;
      }
    }
    for (long long int i = 0; i < n; i++) {
      if (ans[i] == 0) {
        ans[i] = 2;
      }
    }
    vector<long long int> v;
    for (long long int i = 0; i < n; i++) {
      if (ans[i] == 1) {
        v.push_back(str[i] - '0');
      }
    }
    for (long long int i = 0; i < n; i++) {
      if (ans[i] == 2) {
        v.push_back(str[i] - '0');
      }
    }
    long long int first = 1;
    for (long long int i = 1; i < v.size(); i++) {
      if (v[i] < v[i - 1]) {
        first = 0;
      }
    }
    if (first) {
      for (long long int i = 0; i < n; i++) {
        cout << ans[i];
      }
      cout << '\n';
    } else {
      cout << "-\n";
    }
    for (long long int i = 0; i < 10; i++) {
      cnt[i] = 0;
    }
    for (long long int i = 0; i <= n; i++) {
      ans[i] = 0;
    }
  }
  return 0;
}
