#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    string s;
    cin >> n >> s;
    map<long long int, vector<long long int>> mp;
    for (long long int i = 0; i < s.size(); i++) {
      mp[s[i] - '0'].push_back(i);
    }
    vector<long long int> ans(n + 1, 0);
    long long int las = -1;
    for (auto x : mp) {
      vector<long long int> v = x.second;
      long long int cnt = 0;
      for (long long int i = 0; i < v.size(); i++) {
        if (v[i] > las) {
          ans[v[i]] = 1;
          cnt++;
          las = v[i];
        }
      }
      if (cnt != v.size()) {
        break;
      }
    }
    vector<long long int> ck;
    for (long long int i = 0; i < n; i++) {
      if (ans[i] == 1) {
        ck.push_back(s[i] - '0');
      }
    }
    for (long long int i = 0; i < n; i++) {
      if (ans[i] != 1) {
        ck.push_back(s[i] - '0');
      }
    }
    long long int f = 0;
    for (long long int i = 1; i < n; i++) {
      if (ck[i] < ck[i - 1]) {
        f = 1;
        break;
      }
    }
    if (f == 1) {
      cout << "-" << endl;
    } else {
      string str;
      for (long long int i = 0; i < n; i++) {
        if (ans[i] == 0) {
          str += '2';
        } else {
          str += '1';
        }
      }
      cout << str << endl;
    }
  }
  return 0;
}
