#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int arr[200000];
bool inA[200000];
int main() {
  int t;
  cin >> t;
  for (int u = 0; u < t; u++) {
    a = vector<int>();
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
      arr[i] = s.at(i) - 48;
      inA[i] = false;
    }
    for (int i = 0; i < n; i++) {
      while (a.size() > 0 && arr[a[a.size() - 1]] > arr[i]) {
        inA[a[a.size() - 1]] = false;
        a.pop_back();
      }
      a.push_back(i);
      inA[i] = true;
    }
    bool works = true;
    int aV = 0, bV = 0;
    int bStart = -1;
    for (int i = 0; i < n; i++) {
      if (inA[i]) {
        if (arr[i] >= aV) {
          aV = arr[i];
        } else {
          works = false;
          break;
        }
      } else {
        if (bStart == -1) {
          bStart = arr[i];
        }
        if (arr[i] >= bV) {
          bV = arr[i];
        } else {
          works = false;
          break;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      if (inA[i] && arr[i] > bStart && bStart != -1) {
        if (arr[i] < bV) {
          works = false;
          break;
        }
        inA[i] = false;
      }
    }
    if (!works) {
      cout << "-" << endl;
      continue;
    }
    for (int i = 0; i < n; i++) {
      if (inA[i]) {
        cout << 1;
      } else {
        cout << 2;
      }
    }
    cout << endl;
  }
}
