#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5 + 10;
char a[maxn], b[maxn];
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    bool ff = 0;
    int n;
    cin >> n;
    cin >> a;
    for (int i = 0; i <= 9; i++) {
      int p1 = 0, p2 = i;
      int f = 1;
      for (int j = 0; j < n; j++) {
        int tmp = a[j] - '0';
        if (tmp < p2) {
          if (tmp >= p1) {
            p1 = tmp;
            b[j] = '1';
          } else {
            f = 0;
            break;
          }
        } else {
          p2 = tmp;
          b[j] = '2';
        }
        if (p1 > i) {
          f = 0;
          break;
        }
      }
      if (f) {
        ff = 1;
        break;
      }
    }
    if (ff) {
      for (int i = 0; i < n; i++) cout << b[i];
      cout << '\n';
    } else
      cout << '-' << '\n';
  }
  return 0;
}
