#include <bits/stdc++.h>
using namespace std;
char a[200010];
int b[200010];
struct point {
  int x;
  int y;
} v[200010];
bool cmp(point a, point b) {
  if (a.x == b.x) return a.y < b.y;
  return a.x < b.x;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    memset(b, 0, sizeof(b));
    int n;
    scanf("%d", &n);
    scanf("%s", a);
    for (int i = 0; i < n; i++) {
      v[i].x = a[i] - '0';
      v[i].y = i;
    }
    sort(v, v + n, cmp);
    b[v[0].y] = 1;
    int m = n;
    int h = 100;
    int r = 0;
    int e = -1;
    int w = v[0].y;
    int flag = 0;
    for (int i = 1; i < n; i++) {
      if (v[i].x > h && v[i].y > e) {
        m = i;
        e = v[i].y;
        b[e] = 2;
        break;
      }
      if (v[i].y > w) {
        w = v[i].y;
        b[v[i].y] = 1;
      } else {
        if (r == 0) {
          h = v[i].x;
          r = 1;
        }
        if (e < v[i].y) {
          e = v[i].y;
          b[v[i].y] = 2;
          m = i;
        } else {
          flag = 1;
          break;
        }
      }
    }
    int u = v[m].x;
    for (int i = m + 1; i < n; i++) {
      if (v[i].y > e) {
        e = v[i].y;
        b[v[i].y] = 2;
      } else {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      for (int i = 0; i < n; i++) {
        printf("%d", b[i]);
      }
      printf("\n");
    } else
      printf("-\n");
  }
}
