#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
signed main() {
  long long T = read();
  while (T--) {
    bool one = false;
    bool two = false;
    long long n = read();
    string s;
    cin >> s;
    if (s.size() == 1) {
      puts("1");
      continue;
    } else if (s.size() >= 1)
      two = true;
    vector<long long> v;
    for (long long i = 0; i < n + 1; i++) v.push_back(2);
    long long flag = 0;
    long long max2 = -2147483647, max1 = -2147483647;
    long long min2 = 0, flag2 = 0;
    for (long long i = 0; i < n; i++) {
      if (one == false) {
        if (s[i] > s[i + 1] && one == false) {
          one = true;
          char x = s[i], y = s[i + 1];
          max2 = (long long)s[i];
          max1 = (long long)s[i + 1];
          min2 = s[0];
          v[i + 1] = 1;
          for (long long j = i; j >= 0; j--)
            if (max1 >= s[j]) {
              v[j] = 1;
              if (flag2 == 0) {
                min2 = s[j + 1];
                flag2 = 1;
              }
            }
          i++;
        }
      } else {
        if ((long long)s[i] >= max2)
          max2 = s[i];
        else {
          if ((long long)s[i] < max2 && s[i] <= min2 &&
              (long long)s[i] >= max1) {
            v[i] = 1;
            max1 = s[i];
          } else {
            flag = 1;
            break;
          }
        }
      }
    }
    if (flag == 1)
      putchar('-');
    else
      for (long long i = 0; i < n; i++) cout << v[i];
    puts("");
  }
  return 0;
}
