#include <bits/stdc++.h>
using namespace std;
static const int maxn = 3e5 + 5;
int on[maxn];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tc;
  cin >> tc;
  for (int tcase = 1; tcase <= tc; tcase++) {
    int n;
    string s;
    cin >> n >> s;
    vector<int> mark(n, 0);
    vector<bool> boro(n, 0);
    int maxi = 0;
    for (int i = 0; i < n; i++) {
      int x = s[i] - '0';
      if (maxi > x) boro[i] = 1;
      maxi = max(maxi, x);
    }
    bool take = 0;
    int last = 0;
    for (int i = n - 1; i >= 0; i--) {
      int x = s[i] - '0';
      if (take == 1) {
        if (x <= last) {
          mark[i] = 1;
          last = x;
        }
      }
      if (boro[i] == 1) {
        take = 1;
        last = x;
        mark[i] = 1;
      }
    }
    vector<int> vec;
    for (int i = 0; i < n; i++)
      if (mark[i] == 1) vec.push_back(s[i] - '0');
    for (int i = 0; i < n; i++)
      if (mark[i] == 0) vec.push_back(s[i] - '0');
    bool ok = true;
    for (int i = 1; i < n; i++) {
      if (vec[i] < vec[i - 1]) {
        ok = false;
        break;
      }
    }
    if (ok == false) {
      cout << "-" << '\n';
      continue;
    }
    for (int i = 0; i < n; i++) {
      if (mark[i] == 0)
        cout << 2;
      else
        cout << 1;
    }
    cout << '\n';
  }
}
