#include <bits/stdc++.h>
using namespace std;
char st[200001];
pair<int, int> ara[200001];
int ind[200001];
int main() {
  int n, t, i;
  pair<int, int> one, two;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %s", &n, st);
    for (i = 0; i < n; i++) {
      ara[i] = {st[i] - '0', i};
    }
    sort(ara, ara + n);
    one = ara[0];
    ind[ara[0].second] = 1;
    two = {-1, -1};
    for (i = 1; i < n; i++) {
      if ((one.second < ara[i].second || one.first == ara[i].first) &&
          (two.first == -1 || two.first >= ara[i].first)) {
        one = ara[i];
        ind[ara[i].second] = 1;
      } else if (two.second < ara[i].second) {
        if (two.first == -1) two = ara[i];
        two.second = ara[i].second;
        ind[ara[i].second] = 2;
      } else {
        printf("-\n");
        one.first = -1;
        break;
      }
    }
    if (one.first != -1) {
      for (i = 0; i < n; i++) printf("%d", ind[i]);
      printf("\n");
    }
  }
  return 0;
}
