#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int BASE = 31;
const int N = (int)1e6 + 7;
bool sorted(vector<char> x) {
  for (int i = 1; i < (int)x.size(); i++) {
    if (x[i] < x[i - 1]) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    bool found = false;
    for (char c = '0'; c <= '9'; c++) {
      vector<char> a, b;
      vector<int> color(n);
      bool met = false;
      for (int i = 0; i < n; i++) {
        if (met && s[i] == c) {
          a.push_back(s[i]);
          color[i] = 1;
        } else if (s[i] < c) {
          a.push_back(s[i]);
          color[i] = 1;
        } else {
          b.push_back(s[i]);
          color[i] = 2;
        }
        if (s[i] > c) {
          met = true;
        }
      }
      bool invalid = false;
      if (a.size() && b.size() && a.back() > b.front()) {
        invalid = true;
      }
      if (!sorted(a) || !sorted(b)) {
        invalid = true;
      }
      if (!invalid) {
        for (int i = 0; i < n; i++) {
          cout << color[i];
        }
        cout << '\n';
        found = true;
        break;
      }
    }
    if (!found) {
      cout << "-\n";
    }
  }
  return 0;
}
