#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> d(n);
  int j, m = 100;
  for (int i = 0; i < n; i++) {
    d[i] = str[i] - '0';
    if (d[i] < m) {
      m = d[i];
      j = i;
    }
  }
  vector<int> suff(n + 1);
  vector<int> ans(n, 2);
  suff[n] = INT_MAX;
  for (int i = n - 1; i >= 0; i--) {
    suff[i] = min(suff[i + 1], d[i]);
  }
  ans[j] = 1;
  m = 100;
  for (int i = 0; i < j; i++) {
    m = min(m, d[i]);
  }
  for (int i = j + 1; i < n; i++) {
    if (d[i] <= suff[i + 1] && d[i] <= m)
      ans[i] = 1;
    else {
      m = min(m, d[i]);
    }
  }
  vector<int> temp;
  for (int i = 0; i < n; i++) {
    if (ans[i] == 2) temp.push_back(i);
  }
  for (int i = 0; !temp.empty() && i < temp.size() - 1; i++) {
    if (d[temp[i]] > d[temp[i + 1]]) {
      cout << "-" << '\n';
      return;
    }
  }
  for (int x : ans) cout << x;
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
