#include <bits/stdc++.h>
using namespace std;
string s;
pair<int, int> p[200005];
int res[200005], n;
int main() {
  ios::sync_with_stdio(0), cin.tie();
  int t;
  cin >> t;
  while (t--) {
    memset(res, 0, sizeof res);
    cin >> n;
    cin >> s;
    for (int i = 0; i < n; i++) p[i] = {s[i] - '0', i};
    sort(p, p + n);
    int id = -1, id2 = -1;
    int bg = 0;
    bool ok = false;
    for (int i = 0; i < n; i++) {
      if (id == -1) {
        res[p[i].second] = 1;
        id = max(id, p[i].second);
      } else if (p[i].second > id && (id2 == -1 || bg == p[i].first)) {
        res[p[i].second] = 1;
        id = max(id, p[i].second);
      } else if (p[i].second < id && id2 == -1) {
        res[p[i].second] = 2;
        id2 = max(id2, p[i].second);
        bg = p[i].first;
      } else if (id2 != -1 && p[i].second > id2) {
        res[p[i].second] = 2;
        id2 = max(id2, p[i].second);
      } else if (id2 != -1 && p[i].second < id2) {
        ok = true;
        break;
      }
    }
    string w, w2;
    for (int i = 0; i < n; i++)
      if (res[i] == 1) w += s[i];
    for (int i = 0; i < n; i++)
      if (res[i] == 2) w += s[i];
    w2 = w;
    sort(w.begin(), w.end());
    if (w != w2) ok = true;
    if (ok)
      cout << "-\n";
    else {
      for (int i = 0; i < n; i++) cout << res[i];
      cout << endl;
    }
  }
  return 0;
}
