#include <bits/stdc++.h>
using namespace std;
int T, n;
int a[200003], d[200003], c[200003], g[200003];
bool flag = 0;
stack<int> s;
char ts[200003];
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (ch < '0' || ch > '9') w |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9')
    X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
int main() {
  T = read();
  while (T--) {
    memset(g, 0, sizeof(g));
    flag = 0;
    n = read();
    scanf("%s", ts + 1);
    for (int i = 1; i <= n; i++) a[i] = ts[i] - '0';
    for (int i = 0; i <= 9; i++) {
      int res1 = 0, res2 = 0, Min = 2e8, Max = -1;
      bool t = 1;
      for (int j = 1; j <= n; j++) {
        if (a[j] < i) {
          if (res1 > a[j]) {
            t = 0;
            break;
          }
          res1 = a[j];
          Max = j;
          g[j] = 1;
        } else if (a[j] > i) {
          if (res2 > a[j]) {
            t = 0;
            break;
          }
          res2 = a[j];
          Min = min(Min, j);
          g[j] = 2;
        }
      }
      for (int j = 1; j <= n; j++) {
        if (a[j] == i) {
          if (j > Max)
            g[j] = 1;
          else if (j < Min)
            g[j] = 2;
          else {
            t = 0;
            break;
          }
        }
      }
      if (t) {
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      for (int i = 1; i <= n; i++) printf("%d", g[i]);
      puts("");
    } else
      puts("-");
  }
  return 0;
}
