#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<int> n(t);
  vector<string> inputStrings(t);
  for (int i = 0; i < t; i++) {
    cin >> n[i];
    cin >> inputStrings[i];
  }
  for (int test = 0; test < t; test++) {
    vector<int> digit;
    for (auto s : inputStrings[test]) {
      digit.push_back(s - '0');
    }
    deque<pair<int, int> > mark1;
    deque<pair<int, int> > mark2;
    vector<int> marked(n[test], 0);
    mark1.push_front(make_pair(0, digit[0]));
    bool impossible = false;
    for (int i = 1; i < n[test]; i++) {
      if (mark2.size() > 0) {
        if (mark2.front().second > digit[i] &&
            digit[i] >= mark1.front().second) {
          mark1.push_front(make_pair(i, digit[i]));
        } else if (mark2.front().second <= digit[i]) {
          mark2.push_front(make_pair(i, digit[i]));
        } else if (mark1.front().second > digit[i]) {
          auto it = mark1.begin();
          for (; it != mark1.end(); it++) {
            if (!((*it).second > digit[i])) {
              break;
            }
          }
          if (mark2.size() == 0 || mark2.front().second <= (*(it - 1)).second) {
            mark2.insert(mark2.begin(), mark1.begin(), it);
            mark1.erase(mark1.begin(), it);
            mark1.push_front(make_pair(i, digit[i]));
          } else {
            impossible = true;
            break;
          }
        }
      } else {
        if (digit[i] >= mark1.front().second) {
          mark1.push_front(make_pair(i, digit[i]));
        } else if (mark1.front().second > digit[i]) {
          auto it = mark1.begin();
          for (; it != mark1.end(); it++) {
            if (!((*it).second > digit[i])) {
              break;
            }
          }
          if (mark2.size() == 0 || mark2.front().second <= (*(it - 1)).second) {
            mark2.insert(mark2.begin(), mark1.begin(), it);
            mark1.erase(mark1.begin(), it);
            mark1.push_front(make_pair(i, digit[i]));
          } else {
            impossible = true;
            break;
          }
        }
      }
    }
    if (!(mark1.size() == 0 || mark2.size() == 0)) {
      if (mark1.front().second > mark2.back().second) {
        impossible = true;
      }
    }
    for (auto i = 0; i < mark1.size(); i++) {
      marked[mark1[i].first] = 1;
    }
    for (auto i = 0; i < mark2.size(); i++) {
      marked[mark2[i].first] = 2;
    }
    if (impossible) {
      cout << "-" << endl;
      ;
    } else {
      for (auto d : marked) {
        cout << d;
      }
      cout << endl;
    }
  }
  return 0;
}
