#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr static int mod = 1e9 + 7;
constexpr static int inf = (1 << 30) - 1;
constexpr static Int infll = (1LL << 61) - 1;
int Competitive_Programming =
    (ios_base::sync_with_stdio(false), cin.tie(nullptr),
     cout << fixed << setprecision(15), 0);
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target("avx2")
bool is_valid(string &s, vector<int> &coloring) {
  vector<int> res;
  for (int j = 1; j <= 2; j++) {
    for (int i = 0; i < s.size(); i++) {
      if (coloring[i] == j) res.push_back(s[i] - '0');
    }
  }
  for (int i = 1; i < res.size(); i++) {
    if (res[i] < res[i - 1]) return false;
  }
  return true;
}
void solve() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  vector<int> last(10, -1);
  for (int i = 0; i < N; i++) last[s[i] - '0'] = i;
  for (int i = 0; i < 10; i++) {
    vector<int> ans(N, 2);
    int now = 0;
    for (int j = 0; j < N; j++) {
      while (now <= i && last[now] < j) now++;
      if (now > i) break;
      if (now == s[j] - '0') ans[j] = 1;
    }
    if (is_valid(s, ans)) {
      for (int j = 0; j < N; j++) {
        cout << ans[j];
      }
      cout << "\n";
      return;
    }
  }
  cout << "-\n";
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
