#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  cin >> T;
  for (int qq = 1; qq <= T; qq++) {
    long long int n;
    cin >> n;
    string s;
    cin >> s;
    vector<long long int> alp(10, -1);
    for (int i = 0; i < n; i++) alp[s[i] - '0'] = i;
    vector<long long int> ans(n, 2);
    long long int mx = 10;
    for (int i = 0; i < n; i++) {
      int j;
      for (j = 0; j < s[i] - '0'; j++) {
        if (alp[j] > i) break;
      }
      if (j == s[i] - '0' && s[i] - '0' <= mx) {
        ans[i] = 1;
      } else {
        mx = min(mx, (long long int)(s[i] - '0'));
      }
    }
    string ch;
    for (int i = 0; i < n; i++) {
      if (ans[i] == 1) ch.push_back(s[i]);
    }
    for (int i = 0; i < n; i++) {
      if (ans[i] == 2) ch.push_back(s[i]);
    }
    sort(s.begin(), s.end());
    if (ch != s) {
      cout << '-' << endl;
    } else {
      for (int i = 0; i < n; i++) cout << ans[i];
      cout << endl;
    }
  }
  return 0;
}
