#include <bits/stdc++.h>
using namespace std;
long long int fast_expo(long long int x, long long int p) {
  if (p == 0)
    return 1;
  else if (p % 2 == 0) {
    long long int t = fast_expo(x, p / 2) % 1000000007;
    return (t * t) % 1000000007;
  } else
    return (x * (fast_expo(x, p - 1)) % 1000000007) % 1000000007;
}
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    int g = 0, flag = 0, x, mini = -1, mo = -1, ind = -1, j, i;
    cin >> n;
    int ans[n];
    string s;
    cin >> s;
    vector<pair<int, int> > v(n);
    for (i = 0; i < n; i++) {
      v[i].first = int(s[i] - 48);
      v[i].second = i;
    }
    sort(v.begin(), v.end());
    ans[v[0].second] = 1;
    mini = v[0].second;
    for (i = 1; i < n; i++) {
      if (mini < v[i].second) {
        ans[v[i].second] = 1;
        mini = v[i].second;
      } else {
        mo = v[i].second;
        ans[v[i].second] = 2;
        flag = 1;
      }
      if (flag == 1 && v[i].first < v[i + 1].first) {
        ind = i + 1;
        break;
      }
    }
    if (ind != -1) {
      for (j = ind; j < n; j++) {
        if (v[j].second > mo) {
          ans[v[j].second] = 2;
          mo = v[j].second;
        } else {
          g = 1;
          break;
        }
      }
    }
    if (g == 1)
      cout << "-" << endl;
    else {
      for (i = 0; i < n; i++) cout << ans[i];
      cout << endl;
    }
  }
}
