#include <bits/stdc++.h>
using namespace std;
int mark[200002];
vector<int> pos[11];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, l, t, j, cnt, mx, last;
  bool flag;
  string s;
  cin >> t;
  while (t--) {
    cin >> l >> s;
    for (i = 0; i < 10; i++) {
      pos[i].clear();
    }
    mx = -1;
    for (i = 0; i < l; i++) {
      pos[s[i] - '0'].push_back(i);
      mx = max(mx, (s[i] - '0'));
      mark[i] = 0;
    }
    cnt = 0;
    for (i = pos[mx].size() - 1; i >= 0; i--) {
      mark[pos[mx][i]] = 2;
      ++cnt;
      last = pos[mx][i];
    }
    flag = true;
    for (i = mx - 1; i >= 0 && flag; i--) {
      if (pos[i].size() > 0) {
        for (j = pos[i].size() - 1; j >= 0; j--) {
          if (last > pos[i][j]) {
            mark[pos[i][j]] = 2;
            last = pos[i][j];
            ++cnt;
          } else {
            flag = false;
          }
        }
      }
    }
    last = l;
    for (i = mx - 1; i >= 0; i--) {
      if (pos[i].size() > 0) {
        for (j = pos[i].size() - 1; j >= 0; j--) {
          if (mark[pos[i][j]] == 0 && last > pos[i][j]) {
            mark[pos[i][j]] = 1;
            last = pos[i][j];
            ++cnt;
          }
        }
      }
    }
    if (cnt == l) {
      for (i = 0; i < l; i++) {
        cout << mark[i];
      }
      cout << '\n';
    } else {
      cout << "-\n";
    }
  }
  return 0;
}
