#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    int number[200005], dis[10] = {0};
    char c;
    cin >> n;
    for (int a = 1; a <= n; a++) {
      cin >> c;
      number[a] = c - '0';
      dis[number[a]] = 1;
    }
    int f = 0;
    for (int a = 0; a <= 9; a++) {
      int vis[200005];
      for (int j = 1; j <= n; j++) vis[j] = 2;
      int t = 1;
      for (int i = 0; i <= a; i++) {
        if (dis[i] == 0) continue;
        for (int b = t; b <= n; b++)
          if (number[b] == i) {
            vis[b] = 1;
            t = b + 1;
          }
        if (t == n + 1) break;
      }
      int flag = 0;
      int maxx = 0;
      for (int i = 1; i <= n; i++) {
        if (vis[i] == 1) continue;
        if (number[i] >= a && number[i] >= maxx)
          maxx = number[i];
        else {
          flag = 1;
          break;
        }
      }
      if (flag == 1)
        continue;
      else {
        for (int i = 1; i <= n; i++) cout << vis[i];
        cout << endl;
        f = 1;
        break;
      }
    }
    if (f == 0) cout << "-" << endl;
  }
  return 0;
}
