#include <bits/stdc++.h>
using namespace std;
int d[200010];
string s, ans;
void mns() {
  cout << "-"
       << "\n";
}
vector<int> v1, v2;
void solve() {
  int i, n;
  ans.clear();
  v1.clear();
  v2.clear();
  cin >> n >> s;
  for (i = 0; i < n; i++) {
    d[i] = s[i] - '0';
  }
  int j = -1;
  for (i = 0; i < n - 1; i++) {
    if (d[i] > d[i + 1]) {
      j = i;
      break;
    }
  }
  if (j == -1) {
    for (i = 0; i < n; i++) {
      cout << 1;
    }
    cout << "\n";
    return;
  }
  for (i = 0; i <= j; i++) {
    if (d[i] <= d[j + 1]) {
      v1.push_back(d[i]);
      ans.push_back('1');
    } else {
      v2.push_back(d[i]);
      ans.push_back('2');
    }
  }
  if (j != n - 1) {
    v1.push_back(d[j + 1]);
    ans.push_back('1');
  }
  for (i = j + 2; i < n; i++) {
    if (d[i] < d[j + 1]) {
      mns();
      return;
    }
    if (d[i] < d[j]) {
      if (v1.back() > d[i]) {
        mns();
        return;
      }
      v1.push_back(d[i]);
      ans.push_back('1');
    } else if (d[i] == d[j]) {
      if (v2.back() <= d[i]) {
        v2.push_back(d[i]);
        ans.push_back('2');
      } else {
        if (v1.back() <= d[i]) {
          v1.push_back(d[i]);
          ans.push_back('1');
        } else {
          mns();
          return;
        }
      }
    } else {
      if (v2.back() > d[i]) {
        mns();
        return;
      }
      v2.push_back(d[i]);
      ans.push_back('2');
    }
  }
  if (v1.back() > v2[0]) {
    mns();
    return;
  }
  cout << ans << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t) {
    t--;
    solve();
  }
}
