#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int dig;
    cin >> dig;
    string s;
    cin >> s;
    string s1;
    string s2;
    string ans;
    int k, strt, flag;
    k = -1;
    flag = 1;
    strt = -1;
    for (int i = 0; i < dig - 1; ++i) {
      if (s[i] > s[i + 1]) {
        k = i;
        break;
      }
    }
    if (k == -1) {
      for (int i = 0; i < s.size(); ++i) cout << 1;
      cout << endl;
      flag = 0;
    }
    for (int i = 0; i < k; ++i) {
      if (s[i] <= s[k + 1]) {
        s1.push_back(s[i]);
        ans.push_back('1');
      } else {
        strt = i;
        break;
      }
    }
    if (strt != -1) {
      for (int j = strt; j <= k; ++j) {
        s2.push_back(s[j]);
        ans.push_back('2');
      }
    } else {
      s2.push_back(s[k]);
      ans.push_back('2');
    }
    s1.push_back(s[k + 1]);
    ans.push_back('1');
    int mxs1 = s[k + 1];
    int mxs2 = s[k];
    for (int i = k + 2; i <= dig - 1; ++i) {
      if (s[i] >= mxs2) {
        s2.push_back(s[i]);
        mxs2 = s[i];
        ans.push_back('2');
      } else if (s[i] <= s2[0] and s[i] >= mxs1) {
        s1.push_back(s[i]);
        mxs1 = s[i];
        ans.push_back('1');
      } else {
        cout << "-" << endl;
        flag = 0;
        break;
      }
    }
    if (flag) cout << ans << endl;
  }
}
