#include <bits/stdc++.h>
using namespace std;
template <class TYPE>
TYPE gcd(TYPE x, TYPE y) {
  if (y)
    return gcd(y, x % y);
  else
    return x;
}
template <class TYPE>
TYPE lcm(TYPE x, TYPE y) {
  TYPE t = gcd(x, y);
  return t ? (x / t * y) : 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, d[10] = {0};
    string s, ans;
    cin >> n >> s;
    ans = s;
    for (int i = 0; i < n; i++) d[s[i] - '0']++;
    int cur = 0, last_val;
    for (int i = 0; i < n; i++) {
      while (d[cur] == 0) {
        cur++;
      }
      if (s[i] - '0' == cur) {
        d[cur]--;
        ans[i] = '1';
        last_val = cur;
      } else
        ans[i] = '2';
    }
    bool check = true;
    for (int i = 0; i < n; i++) {
      if (ans[i] == '2') {
        if (s[i] - '0' < cur) {
          check = false;
          break;
        } else
          cur = s[i] - '0';
      }
    }
    if (check)
      cout << ans << endl;
    else
      cout << '-' << endl;
  }
  return 0;
}
