#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getrnd(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
template <typename T1, typename T2>
bool relax(T1& a, const T2& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
bool strain(T1& a, const T2& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (char d = '0' - 1; d <= '9'; ++d) {
    vector<int> cnt(256, 0);
    for (int i = 0; i < n; ++i) cnt[s[i]]++;
    char x = '0' - 1;
    string s1, s2, res(n, '1');
    for (int i = 0; i < n; ++i) {
      while (cnt[x] == 0) ++x;
      if (x <= d && s[i] == x)
        s1 += x, cnt[x]--;
      else
        s2 += s[i], res[i] = '2';
    }
    string ans = s1 + s2;
    if (is_sorted(ans.begin(), ans.end())) {
      cout << res << '\n';
      return;
    }
  }
  cout << "-\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  srand(time(0));
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
