#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
using namespace std;
bool Solve(int n, vector<int> &val, int mid, vector<bool> &ans) {
  int last0 = 0, last1 = mid;
  for (int i = 0; i < n; i++) {
    if (val[i] >= last1) {
      ans[i] = true;
      last1 = val[i];
    } else {
      if (val[i] > mid || val[i] < last0) {
        return false;
      }
      ans[i] = false;
      last0 = val[i];
    }
  }
  return true;
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  int test_c;
  cin >> test_c;
  while (test_c--) {
    int n;
    cin >> n;
    vector<int> val(n);
    for (int i = 0; i < n; i++) {
      char a;
      cin >> a;
      val[i] = (a - '0');
    }
    vector<bool> ans(n);
    bool can = false;
    for (int i = 0; i < 10; i++) {
      if (Solve(n, val, i, ans)) {
        can = true;
        break;
      }
    }
    if (can) {
      for (int a : ans) {
        cout << a + 1;
      }
      cout << '\n';
    } else {
      cout << '-' << '\n';
    }
  }
}
