#include <bits/stdc++.h>
using namespace std;
void Input();
void solve();
void test_cases();
int test_case = 1;
signed main() {
  test_case = 1;
  test_cases();
  while (test_case--) {
    Input();
    solve();
  }
}
const int M = 2e5;
int n, k, a, m, b, c, d, x, A, B, C;
vector<int> ar, br, v, left, right;
multiset<int> st, st1, st2;
map<int, int> mp;
string str, str2;
int maxi;
void Input() { cin >> n >> str; }
bool go(char x, char y) {
  char sy = y;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    if (str[i] >= y) {
      ans[i] = 2;
      y = str[i];
    } else if (str[i] >= x) {
      ans[i] = 1;
      x = str[i];
    } else
      return false;
  }
  if (x > sy) return false;
  for (int x : ans) cout << x;
  cout << endl;
  return true;
}
void solve() {
  for (int x = 0; x < 10; x++) {
    if (go('0', '0' + x)) {
      return;
    }
  }
  cout << "-" << endl;
}
void test_cases() { cin >> test_case; }
