#include <bits/stdc++.h>
using namespace std;
using namespace std;
int inf = 0x3f3f3f3f;
char a[200020];
int dp[200020];
int vis[200020];
void dfs(int pos, char &last) {
  if (last != 0 && a[pos] < last) return;
  vis[pos] = 1;
  if (pos == 1) return;
  if (last == 0 && dp[pos - 1] != pos - 1) last = a[pos - 1];
  dfs(dp[pos - 1], last);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    scanf("%d", &n);
    scanf("%s", a + 1);
    fill(vis, vis + n + 1, 0);
    char maxc = a[1];
    dp[1] = 1;
    for (int i = 2; i < n + 1; ++i) {
      if (maxc <= a[i]) {
        maxc = a[i];
        dp[i] = i;
      } else
        dp[i] = dp[i - 1];
    }
    char last = 0;
    if (dp[n] != n) last = a[n];
    dfs(dp[n], last);
    int flag = 1;
    char pre = 'a';
    for (int i = 1; i < n + 1; ++i) {
      if (vis[i]) continue;
      if (pre == 'a') {
        pre = a[i];
        continue;
      }
      if (a[i] < pre) {
        flag = 0;
        break;
      }
      pre = a[i];
    }
    if (!flag)
      printf("-\n");
    else {
      for (int i = 1; i < n + 1; ++i) {
        if (vis[i])
          printf("2");
        else
          printf("1");
      }
      puts("");
    }
  }
}
