#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const int N = 2e5 + 10;
int a[N];
int mn[N];
int answ[N];
void solve() {
  int n;
  cin >> n;
  bool fl = true;
  int r1 = -1;
  int l2 = -1;
  int r2 = -1;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    a[i] = s[i] - '0';
  }
  mn[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    mn[i] = min(mn[i + 1], a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] <= mn[i]) {
      if (a[i] > l2 && l2 != -1) {
        if (a[i] >= r2) {
          answ[i] = 2;
          r2 = a[i];
        } else {
          fl = false;
          break;
        }
      } else if (a[i] >= r1) {
        r1 = a[i];
        answ[i] = 1;
      } else {
        fl = false;
        break;
      }
    } else {
      if (a[i] >= r2) {
        answ[i] = 2;
        r2 = a[i];
        if (l2 == -1) l2 = a[i];
      } else {
        fl = false;
        break;
      }
    }
  }
  if (!fl) {
    cout << "-\n";
  } else {
    for (int i = 0; i < n; i++) {
      cout << answ[i];
    }
    cout << '\n';
  }
}
signed main() {
  fast();
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
