#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
const long double EPS = 10e-9;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
inline void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, size_t N, typename... V>
void _print(T const (&x)[N], V... v) {
  __print(x);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int32_t n;
  int32_t m;
  int32_t x, l, k;
  int32_t index;
  int32_t t;
  int32_t tmp;
  int32_t ans = 0;
  int32_t best = 0;
  string d((int32_t)2e5, '0');
  string str;
  vector<int32_t> v;
  cin >> t;
  for (int32_t dummy = 0; dummy < (int32_t)(t); ++dummy) {
    cin >> l >> str;
    ;
    v.reserve(l);
    fill(d.begin(), d.begin() + l, '0');
    auto xx = str;
    sort(((xx).begin()), ((xx).end()));
    tmp = 0;
    auto i = str.begin();
    while (i != str.end()) {
      i = find(i, str.end(), xx[tmp]);
      if (i == str.end()) {
        break;
      }
      d[i - str.begin()] = '1';
      i++;
      tmp++;
    };
    for (int32_t i = 0; i < (int32_t)(l); ++i) {
      if (d[i] != '1') {
        d[i] = '2';
      } else {
        v.push_back(str[i] - '0');
      }
    }
    for (int32_t i = 0; i < (int32_t)(l); ++i) {
      if (d[i] != '1') {
        v.push_back(str[i] - '0');
      }
    };
    tmp = 0;
    for (int32_t i = 0; i < (int32_t)(l); ++i) {
      if (v[i] < tmp) {
        d[0] = '-';
        l = 1;
        break;
      } else {
        tmp = v[i];
      }
    }
    v.clear();
    ;
    cout << d.substr(0, l) << "\n";
  }
  return 0;
}
