#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char s[N];
char ans[N];
char suf[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i++) ans[i] = ' ';
    if (n == 1) {
      printf("1\n");
      continue;
    }
    int max2 = '0', max1 = '0', min2 = -1;
    bool flag = true, first = true;
    suf[n] = '9';
    for (int i = n - 1; i >= 1; i--) suf[i] = min(suf[i + 1], s[i + 1]);
    for (int i = 1; i <= n - 1; i++) {
      if (s[i] > suf[i] && s[i] >= max2) {
        ans[i] = '2', max2 = s[i];
        if (first) {
          first = false;
          max2 = min2 = s[i];
        } else
          max2 = s[i];
      } else if (s[i] <= suf[i] && s[i] >= max1 &&
                 (min2 == -1 || s[i] <= min2)) {
        ans[i] = '1';
        max1 = s[i];
      } else if (s[i] <= suf[i] && s[i] >= max2) {
        ans[i] = '2';
        max2 = s[i];
      } else {
        flag = false;
        break;
      }
    }
    if (s[n] >= max2)
      ans[n] = '2';
    else if (min2 != -1 && s[n] >= max1 && s[n] <= min2)
      ans[n] = '1';
    else
      flag = false;
    ans[n + 1] = '\0';
    printf("%s\n", flag ? ans + 1 : "-");
  }
  return 0;
}
