#include <bits/stdc++.h>
using namespace std;
using namespace std;
int T;
string a;
int s[200080];
int flag[200080];
int n;
int main() {
  cin >> T;
  while (T--) {
    cin >> n;
    cin >> a;
    int now;
    bool oh = 1;
    for (int t = 0; t <= 9; t++) {
      oh = 1;
      now = t + '0';
      int b = 100000;
      for (int i = n - 1; i >= 0; i--) {
        if (a[i] <= now) {
          now = a[i];
          flag[i] = 1;
        } else {
          if (a[i] >= t + '0' && a[i] <= b) {
            b = a[i];
            flag[i] = 2;
          } else {
            oh = 0;
            break;
          }
        }
      }
      if (oh == 1) break;
    }
    if (oh == 0) {
      cout << "-";
    } else {
      for (int i = 0; i < n; i++) {
        cout << flag[i];
      }
    }
    cout << endl;
  }
  return 0;
}
