#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
long long factorial(long long n) {
  return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }
long long max(long long a, long long b) {
  long long sol = a > b ? a : b;
  return sol;
}
long long min(long long a, long long b) {
  long long sol = a < b ? a : b;
  return sol;
}
long long INF = (1LL << 62);
inline void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> v(n);
  for (int i = 0; i < n; i++) v[i] = (s[i] - '0');
  vector<int> ans;
  for (int d = 0; d < 10; d++) {
    vector<int> x(n, 1);
    for (int i = 0; i < n; i++) {
      if (v[i] > d) {
        x[i] = 2;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (v[i] < d) {
        for (int j = i - 1; j >= 0; j--) {
          if (v[j] == d) x[j] = 2;
        }
        break;
      }
    }
    bool flag = 0;
    int last = -1;
    for (int j = 1; j <= 2; j++) {
      for (int i = 0; i < n; i++) {
        if (x[i] == j) {
          if (v[i] < last) {
            flag = 1;
            break;
          }
          last = v[i];
        }
      }
      if (flag) break;
    }
    if (!flag) {
      ans = x;
      break;
    }
  }
  if ((int)ans.size()) {
    for (int i = 0; i < n; i++) {
      cout << (char)(ans[i] + '0');
    }
    cout << "\n";
  } else {
    cout << "-\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
