#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
template <typename T>
void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  x *= f;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
char s[MAXN];
int n, l[MAXN], r[MAXN];
void solve() {
  int now = 0;
  static char ans[MAXN];
  for (int i = 1; i <= n + 1; i++) ans[i] = 0;
  for (int p = 0; p <= 9; p++) {
    if (l[p] == -1) continue;
    if (l[p] < now) {
      char Max = 0;
      for (int i = 1; i <= n; i++)
        if (s[i] - '0' < p || (s[i] - '0' == p && i > now)) {
          ans[i] = '1';
        } else {
          ans[i] = '2';
          if (s[i] < Max) {
            puts("-");
            return;
          }
          Max = s[i];
        }
      printf("%s\n", ans + 1);
      return;
    } else
      now = r[p];
  }
  for (int i = 1; i <= n; i++) ans[i] = '1';
  printf("%s\n", ans + 1);
}
int main() {
  int T;
  read(T);
  while (T--) {
    read(n);
    scanf("\n%s", s + 1);
    for (int i = 0; i <= 9; i++) l[i] = r[i] = -1;
    for (int i = 1; i <= n; i++) {
      int x = s[i] - '0';
      if (l[x] == -1)
        l[x] = r[x] = i;
      else
        r[x] = i;
    }
    solve();
  }
  return 0;
}
