#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char a[N];
bool f[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    scanf("%s", a + 1);
    for (int i = 1; i <= n; ++i) a[i] -= '0';
    bool allf = true;
    for (int x = 0; allf && x <= 9; ++x) {
      memset(f, false, sizeof(bool) * (n + 1));
      bool flag = true;
      int now = 0, lst = 0;
      for (int i = 1; flag && i <= n; ++i) {
        if (a[i] < x && a[i] < now)
          flag = false;
        else if (a[i] < x)
          now = a[i], lst = i, f[i] = true;
      }
      for (int i = lst + 1; flag && i <= n; ++i)
        if (a[i] == x) f[i] = true;
      now = 0;
      for (int i = 1; flag && i <= n; ++i)
        if (!f[i] && a[i] < now)
          flag = false;
        else if (!f[i])
          now = a[i];
      if (flag) {
        for (int i = 1; i <= n; ++i) putchar(f[i] ? '1' : '2');
        puts("");
        allf = false;
      }
    }
    if (allf) puts("-");
  }
}
