#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
template <class T>
inline void ckmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void ckmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
using VI = vector<int>;
string solve(string s0) {
  for (int d = 0; d < (10); ++d) {
    int n = ((int)s0.length());
    string s = s0;
    string r = string(n, ' ');
    int last1 = -1;
    for (int i = 0; i < (n); ++i) {
      if (s[i] - '0' < d)
        r[i] = '1', last1 = i;
      else if (s[i] - '0' > d)
        r[i] = '2';
    }
    for (int i = 0; i < (n); ++i)
      if (s[i] - '0' == d) r[i] = (i > last1 ? '1' : '2');
    string g = "";
    for (int i = 0; i < (n); ++i)
      if (r[i] == '1') g += s[i];
    for (int i = 0; i < (n); ++i)
      if (r[i] == '2') g += s[i];
    int ok = 1;
    for (int i = 0; i < (n - 1); ++i)
      if (g[i] > g[i + 1]) ok = 0;
    if (ok) return r;
  }
  return "-";
}
int main() {
  std::ios::sync_with_stdio(false);
  int testcase;
  for (cin >> testcase; testcase > 0; testcase--) {
    int n;
    string s;
    cin >> n >> s;
    string ret = solve(s);
    printf("%s\n", ret.c_str());
  }
  return 0;
}
