#include <bits/stdc++.h>
using namespace std;
char out[200005];
char str[200005];
bool ok(string x) {
  for (int i = 1; i < x.size(); i++) {
    if (x[i - 1] > x[i]) return false;
  }
  return true;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    scanf("%s", str + 1);
    bool alright = false;
    for (int bound = 0; bound < 10; bound++) {
      vector<int> idxs;
      string s1, s2;
      int bck1 = 0;
      int frn2 = n;
      for (int i = 1; i <= n; i++) {
        if (str[i] - 48 < bound) {
          s1.push_back(str[i]);
          out[i] = '1';
          bck1 = max(bck1, i);
        } else if (str[i] - 48 > bound) {
          s2.push_back(str[i]);
          out[i] = '2';
          frn2 = min(frn2, i);
        } else {
          idxs.push_back(i);
        }
      }
      if (ok(s1) && ok(s2)) {
        bool shit = false;
        for (int i = 1; i <= n; i++) {
          if (str[i] - 48 == bound) {
            if (i < frn2)
              out[i] = '2';
            else if (i > bck1)
              out[i] = '1';
            else
              shit = true;
          }
        }
        if (shit) continue;
        printf("%s\n", out + 1);
        alright = true;
        break;
      }
    }
    if (!alright) printf("-\n");
    for (int i = 0; i <= n; i++) out[i] = 0;
  }
  return 0;
}
