#include <bits/stdc++.h>
using namespace std;
vector<int> ans;
bool calc(string &str, int n, int num) {
  vector<bool> seen(n);
  for (int i = 0; i < n; i++) seen[i] = false;
  vector<int> first;
  int last = -1;
  for (int i = 0; i < n; i++) {
    int digit = str[i] - '0';
    if (digit <= num) {
      if (digit >= last) {
        first.push_back(i);
        seen[i] = true;
      } else
        return false;
      last = digit;
    }
  }
  int lastPos = -1;
  if (first.size() != 0) lastPos = first.back();
  for (int i = lastPos + 1; i < n; i++) {
    int digit = str[i] - '0';
    if (digit == num + 1) {
      first.push_back(i);
      seen[i] = true;
    }
  }
  vector<int> second;
  for (int i = 0; i < n; i++) {
    if (seen[i] == false) second.push_back(i);
  }
  last = -1;
  if (first.size() != 0) {
    int lastPos = first.back();
    int digit = str[lastPos] - '0';
    last = digit;
  }
  for (int i = 0; i < second.size(); i++) {
    int pos = second[i];
    int digit = str[pos] - '0';
    if (digit < last) return false;
    last = digit;
  }
  ans.clear();
  ans.resize(n);
  for (int i = 0; i < first.size(); i++) {
    int pos = first[i];
    ans[pos] = 1;
  }
  for (int i = 0; i < second.size(); i++) {
    int pos = second[i];
    ans[pos] = 2;
  }
  return true;
}
void prnt() {
  for (int i = 0; i < ans.size(); i++) printf("%d", ans[i]);
  printf("\n");
}
int main() {
  int cases;
  scanf("%d", &cases);
  while (cases--) {
    int n;
    scanf("%d", &n);
    string str;
    cin >> str;
    bool flag = false;
    for (int i = -1; i < 10; i++) {
      flag = calc(str, n, i);
      if (flag) {
        prnt();
        break;
      }
    }
    if (flag == false) printf("-\n");
  }
}
