#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
const long long mod = 1e9 + 7;
int t;
int n;
pair<int, int> d[N];
int ans[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t) {
    --t;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      char e;
      cin >> e;
      d[i].first = int(e - '0');
      d[i].second = i;
    }
    int cnt = 0, f, s;
    sort(d + 1, d + 1 + n);
    for (int i = 2; i <= n; ++i) {
      if (d[i].second < d[i - 1].second) {
        ++cnt;
        if (cnt == 1)
          f = i;
        else
          s = i;
      }
    }
    if (cnt > 2 || cnt == 2 && d[f].first != d[s - 1].first) {
      cout << '-' << "\n";
      continue;
    }
    if (cnt == 1) {
      for (int i = 1; i < f; ++i) ans[d[i].second] = 1;
      for (int i = f; i <= n; ++i) ans[d[i].second] = 2;
      for (int i = 1; i <= n; ++i) cout << ans[i];
      cout << "\n";
      continue;
    }
    if (cnt == 0) {
      for (int i = 1; i <= n; ++i) cout << 1;
      cout << "\n";
      continue;
    }
    int pos = 0;
    for (int i = f; i < s; ++i) {
      if (d[i].second > d[f - 1].second) {
        pos = i;
        break;
      }
    }
    if (pos == 0 || d[pos - 1].second > d[s].second) {
      cout << '-' << "\n";
      continue;
    }
    for (int i = 1; i < f; ++i) ans[d[i].second] = 1;
    for (int i = f; i < pos; ++i) ans[d[i].second] = 2;
    for (int i = pos; i < s; ++i) ans[d[i].second] = 1;
    for (int i = s; i <= n; ++i) ans[d[i].second] = 2;
    for (int i = 1; i <= n; ++i) cout << ans[i];
    cout << "\n";
  }
  return 0;
}
