#include <bits/stdc++.h>
using namespace std;
int arr[200010];
string s;
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s;
    for (int i = 0; i < n; i++) {
      arr[i] = s[i] - '0';
    }
    int cur1, cur2, ans, ind;
    for (int i = 0; i <= 10; i++) {
      for (int j = 0; j < n; j++) {
        if (arr[j] > i) {
          ind = j;
          break;
        }
      }
      ans = i;
      bool flag = 1;
      cur1 = 0;
      cur2 = 0;
      for (int j = 0; j < n; j++) {
        int look = arr[j];
        if (look < i) {
          if (look < cur1) {
            flag = 0;
          } else {
            cur1 = look;
          }
        } else if (look > i) {
          if (look < cur2) {
            flag = 0;
          } else {
            cur2 = look;
          }
        } else {
          if (j > ind) {
            if (look < cur1) {
              flag = 0;
            } else {
              cur1 = look;
            }
          }
        }
      }
      if (flag == 1) {
        break;
      }
    }
    if (ans <= 9) {
      for (int i = 0; i < n; i++) {
        if (arr[i] < ans) {
          cout << "1";
        } else if (arr[i] > ans) {
          cout << "2";
        } else {
          if (i < ind) {
            cout << "2";
          } else {
            cout << "1";
          }
        }
      }
      cout << endl;
    } else {
      cout << '-' << endl;
    }
  }
}
