#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<pair<int, int>> p;
  vector<int> m(n + 1);
  for (int i = 0; i < n; ++i) {
    p.push_back({s[i] - '0', i});
  }
  sort(p.begin(), p.end());
  int cur = -1;
  int curmax = 9;
  for (int i = 0; i < n; ++i) {
    if (p[i].first > curmax) break;
    if (cur < p[i].second) {
      m[p[i].second] = 1;
      cur = p[i].second;
    } else {
      curmax = min(curmax, p[i].first);
    }
  }
  int prev = -1;
  int ok = 1;
  for (int i = 0; i < n && ok; ++i) {
    if (m[p[i].second]) continue;
    if (p[i].second < prev) ok = 0;
    prev = p[i].second;
  }
  if (!ok) {
    cout << "-" << endl;
    return;
  }
  for (int i = 0; i < n; ++i) {
    if (m[i])
      cout << 1;
    else
      cout << 2;
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
