#include <bits/stdc++.h>
using namespace std;
const int N = 200050;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int T, n;
int a[N];
char ch[N];
bool vis[N];
int main() {
  T = read();
  while (T-- > 0) {
    n = read();
    scanf("%s", ch + 1);
    for (int i = 1; i <= n; i++) a[i] = ch[i] - '0';
    bool goal = 1;
    for (int j = 0; j <= 9; j++) {
      memset(vis, 0, sizeof vis);
      int minn = 10, qwq = 0;
      ;
      for (int i = n; i >= 1; i--) {
        if (a[i] > j) continue;
        if (minn < a[i]) {
          if (a[i] < j) {
            qwq = 1;
            break;
          }
        } else {
          vis[i] = 1;
          minn = a[i];
        }
      }
      if (qwq) continue;
      int last = 10, flag = 1;
      for (int i = n; i >= 1; i--) {
        if (vis[i] || a[i] < j) continue;
        if (a[i] > last) {
          flag = 0;
          break;
        }
        last = a[i];
      }
      if (flag) {
        for (int i = 1; i <= n; i++) printf("%d", vis[i] ? 1 : 2);
        cout << endl;
        goal = 0;
        break;
      }
    }
    if (goal) printf("-\n");
  }
  return 0;
}
