#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, j, k;
    string s;
    cin >> n >> s;
    char i;
    int vis[200001];
    for (i = '0'; i <= '9'; i++) {
      bool ok1 = 0, ok2 = 0;
      memset(vis, 0, n * sizeof(int));
      string s1 = "", s2 = "", ans, temp = "";
      int u = n - 1;
      for (j = 0; j < n; j++) {
        if (s[j] < i) {
          s1 += s[j];
        } else if (s[j] > i) {
          s2 += s[j];
          ok1 = 1;
        }
        if (!ok1 && s[j] == i) temp += s[j], vis[j] = 2;
        if (ok1 && s[j] == i) s1 += s[j], vis[j] = 1;
      }
      s2 = temp + s2;
      ans = s1 + s2;
      sort(ans.begin(), ans.end());
      if (ans == s1 + s2) {
        break;
      }
    }
    if (i == '9' + 1) {
      cout << '-';
    } else {
      for (j = 0; j < n; j++) {
        if (s[j] < i)
          cout << 1;
        else if (s[j] > i)
          cout << 2;
        if (s[j] == i) {
          cout << vis[j];
        }
      }
    }
    cout << endl;
  }
}
