#include <bits/stdc++.h>
using namespace std;
mt19937 rng(static_cast<unsigned int>(
    chrono::steady_clock::now().time_since_epoch().count()));
template <typename num_t>
inline void add_mod(num_t& a, const long long& b, const int& m) {
  a = (a + b) % m;
  if (a >= m) a -= m;
  if (a < 0) a += m;
}
template <typename num_t>
inline bool update_max(num_t& a, const num_t& b) {
  return a < b ? a = b, true : false;
}
template <typename num_t>
inline bool update_min(num_t& a, const num_t& b) {
  return a > b ? a = b, true : false;
}
template <typename num_t>
num_t gcd(num_t lhs, num_t rhs) {
  return !lhs ? rhs : gcd(rhs % lhs, lhs);
}
template <typename num_t>
num_t pw(num_t n, num_t k, const num_t& mod) {
  if (k == -1) k = mod - 2;
  num_t res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) res = 1ll * res * n % mod;
    n = 1ll * n * n % mod;
  }
  return res % mod;
}
const int inf = 1e9 + 7;
const int mod = 998244353;
const long long ll_inf = (long long)inf * inf;
const int base = 64;
void solve() {
  int test;
  cin >> test;
  while (test-- > 0) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<pair<int, int>> idx(n);
    for (int i = (0), _b = (n); i < _b; ++i) idx[i] = {s[i], i};
    sort(idx.begin(), idx.end());
    string ans(n, '2');
    for (int i = 1; i < n; ++i)
      if (idx[i].first != idx[i - 1].first &&
          idx[i].second < idx[i - 1].second) {
        for (int j = i; j < n; ++j)
          if (idx[j].first == idx[i].first && idx[j].second > idx[i - 1].second)
            ans[idx[j].second] = '1';
        for (int j = i - 1; j >= 0; --j) ans[idx[j].second] = '1';
        break;
      }
    map<int, int> last;
    last['1'] = -1;
    last['2'] = -1;
    bool check = true;
    for (int i = 0; i < n && check; ++i) {
      if (s[i] < last[ans[i]]) {
        check = false;
      } else {
        last[ans[i]] = s[i];
      }
    }
    if (check)
      cout << ans << '\n';
    else
      cout << "-\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
