#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int moth[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int dirs[8][2] = {1, 0, 0, 1, -1, 0, 0, -1, -1, -1, -1, 1, 1, -1, 1, 1};
const int mod = 1e9 + 7;
long long _pow(long long aa, long long nn) {
  long long ans = 1;
  while (nn) {
    if (nn & 1) ans = (ans * aa) % mod;
    aa = (aa * aa) % mod;
    nn >>= 1;
  }
  return ans;
}
const int N = 2e5 + 11;
string str;
long long n, sz, ida[N], idb[N], ans[N], idc[N], vis[N];
inline long long read() {
  register long long now = 0;
  register char ch = getchar();
  register bool sign = false;
  while (!isdigit(ch)) {
    if (ch == '-') sign = true;
    ch = getchar();
  }
  while (isdigit(ch)) {
    now = (now << 1) + (now << 3) + ch - '0';
    ch = getchar();
  }
  return (sign == true ? -now : now);
}
inline unsigned long long get_hash() {
  register unsigned long long ret = 1;
  register char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    ret = (ret * 31 + ch);
    ch = getchar();
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> str;
    sz = n;
    int flag = 0;
    for (long long i = 0; i <= 9; i++) {
      long long la = 0, lb = 0, lc = 0;
      char a = '0', b = '0';
      for (long long i = 0; i <= n; i++) {
        vis[i] = 0;
      }
      for (long long j = 0; j < sz; j++) {
        if (str[j] < '0' + i && str[j] >= a) {
          a = str[j];
          la++;
          ida[la] = j;
        }
      }
      for (long long j = 0; j < sz; j++) {
        if (str[j] > '0' + i && str[j] >= b) {
          b = str[j];
          lb++;
          idb[lb] = j;
        }
      }
      if (la == 0) {
        ida[0] = 0;
      }
      for (long long j = 0; j < sz; j++) {
        if (str[j] == '0' + i) {
          if (j > ida[la]) {
            ida[++la] = j;
            vis[j] = 1;
          }
        }
      }
      for (long long j = 0; j < sz; j++) {
        if (str[j] == '0' + i && !vis[j]) {
          idc[++lc] = j;
        }
      }
      if (lc == 0) {
        if (la + lb == sz) {
          for (long long j = 1; j <= la; j++) {
            ans[ida[j]] = 1;
          }
          for (long long j = 1; j <= lb; j++) {
            ans[idb[j]] = 2;
          }
          flag = 1;
          break;
        }
      } else {
        if (lb == 0) {
          if (la + lc == sz) {
            for (long long j = 1; j <= la; j++) {
              ans[ida[j]] = 1;
            }
            for (long long j = 1; j <= lc; j++) {
              ans[idc[j]] = 2;
            }
            flag = 1;
            break;
          }
        } else {
          if (idc[lc] < idb[1] && la + lb + lc == sz) {
            for (long long j = 1; j <= la; j++) {
              ans[ida[j]] = 1;
            }
            for (long long j = 1; j <= lb; j++) {
              ans[idb[j]] = 2;
            }
            for (long long j = 1; j <= lc; j++) {
              ans[idc[j]] = 2;
            }
            flag = 1;
            break;
          }
        }
      }
    }
    if (!flag) {
      printf("-\n");
    } else {
      for (long long i = 0; i < sz; i++) {
        printf("%lld", ans[i]);
      }
      puts("");
    }
  }
  return 0;
}
