#include <bits/stdc++.h>
using namespace std;
int ans[2000005];
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<pair<int, int>> vec;
    for (int i = 0; i < n; i++) {
      vec.push_back({s[i], i});
    }
    sort(vec.begin(), vec.end());
    bool fail;
    for (int mid = '0'; mid <= '9'; mid++) {
      for (int i = 0; i < n; i++) ans[i] = 0;
      int mx1 = -1, mx2 = -1;
      int mxv1 = -1, mxv2 = -1;
      fail = false;
      for (int i = 0; i < n; i++) {
        int val = vec[i].first;
        int idx = vec[i].second;
        if (val <= mid && !ans[idx] && idx > mx1) {
          mx1 = idx;
          ans[idx] = 1;
        }
      }
      for (int i = 0; i < n; i++) {
        int val = vec[i].first;
        int idx = vec[i].second;
        if (val >= mid && !ans[idx] && idx > mx2) {
          mx2 = idx;
          ans[idx] = 2;
        }
      }
      for (int i = 0; i < n; i++) {
        int idx = vec[i].second;
        if (!ans[idx]) {
          fail = true;
        }
      }
      if (!fail) break;
    }
    if (fail)
      cout << "-\n";
    else {
      for (int i = 0; i < n; i++) cout << ans[i];
      cout << "\n";
    }
    for (int i = 0; i < n; i++) ans[i] = 0;
  }
}
