#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1e5, 1e15);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1e5)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
        Build();
        ll Last = -1;
        ll Mx = -1;
        for(int i = 0 ; i < n ; i++)
        {
            pair<int,int> Bla = Query(i, n - 1);
            if(Bla.Sc < Last)
                break;
            if(i != Bla.Sc && Mx == -1)
                Mx = s[i] - '0';
            if(Bla.Fr > Mx && Mx != -1)
                break;
            Last = Bla.Sc;
            Mem.pb(Bla.Fr);
            Update(Bla.Sc, Bla.Sc);

        }
        int j = 0;
        bool Done = false;
        for(int i = 0 ; i < n ; i++)
        {
            if(s[i] - '0' == Mem[j] && !Done)
            {
                Num1.pb(i);
                j++;
            }
            else
                Num2.pb(i);
            if(Mem.sz == j)
            {
                Done = true;
            }
        }
        string Temp;
        Temp.resize(n);
        int o = 0;
        j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        for(int i = 0 ; i < 200200 ; i++)
            Tree[i] = make_pair(0, 0);
        Num1.clear();
        Num2.clear();
        Mem.clear();
        cout << endl;

    }

}


#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
set<int> ss;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1000000, 1000000);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1000000)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        Tree[Now].Sc = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
        Build();
        ll Last = -1;
        ll Mx = -1;
        for(int i = 0 ; i < n ; i++)
        {
            pair<int,int> Bla = Query(i, n - 1);
            if(Bla.Sc <= Last)
                break;
            if(ss.sz > 0 && Bla.Fr > *ss.begin())
                break;
            if(i != Bla.Sc && Query(i, i) != make_pair(1000000, 1000000))
                ss.insert(s[i] - '0');
            Last = Bla.Sc;
            Mem.pb(Bla.Fr);
            Update(Bla.Sc, Bla.Sc);

        }
        int j = 0;
        bool Done = false;
        for(int i = 0 ; i < n ; i++)
        {
            if(s[i] - '0' == Mem[j] && !Done)
            {
                Num1.pb(i);
                j++;
            }
            else
                Num2.pb(i);
            if(Mem.sz == j)
            {
                Done = true;
            }
        }
        string Temp;
        Temp.resize(n);
        int o = 0;
        j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        for(int i = 0 ; i < n * 4 + 7 ; i++)
            Tree[i] = make_pair(0, 0);
        Num1.clear();
        Num2.clear();
        Mem.clear();
        ss.clear();
        cout << endl;

    }

}


#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
set<int> ss;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1000000, 1000000);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1000000)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        Tree[Now].Sc = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
//        int Cnt = 0;
//        string Temp = s;
//        sort(Temp.begin(), Temp.end());
//        for(int i = 0 ; i < s.sz ; i++)
//        {
//            if(Temp[Cnt] == s[i])
//                Num1.pb(i), Cnt++;
//            else
//                Num2.pb(i);
//        }
        Build();
        ll Last = -1;
        ll Mx = -1;
        for(int i = 0 ; i < n ; i++)
        {
            pair<int,int> Bla = Query(i, n - 1);
            if(Bla.Sc <= Last)
                break;
            if(ss.sz > 0 && Bla.Fr > *ss.begin())
                break;
            if(i != Bla.Sc && Query(i, i) != make_pair(1000000, 1000000))
                ss.insert(s[i] - '0');
            Last = Bla.Sc;
            Mem.pb(Bla.Fr);
            Update(Bla.Sc, Bla.Sc);

        }
        int j = 0;
        bool Done = false;
        for(int i = 0 ; i < n ; i++)
        {
            if(s[i] - '0' == Mem[j] && !Done)
            {
                Num1.pb(i);
                j++;
            }
            else
                Num2.pb(i);
            if(Mem.sz == j)
            {
                Done = true;
            }
        }
        string Temp;
        Temp.resize(n);
        int o = 0;
         j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(o < Num1.sz && Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        Num1.clear();
        Num2.clear();
        Mem.clear();
        ss.clear();
        for(int i = 0 ; i < n * 4 + 8 ; i++)
            Tree[i] = make_pair(0, 0);
        cout << endl;

    }

}


#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
set<int> ss;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1000000, 1000000);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1000000)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        Tree[Now].Sc = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
        int Cnt = 0;
        string Temp = s;
        sort(Temp.begin(), Temp.end());
        for(int i = 0 ; i < s.sz ; i++)
        {
            if(Temp[Cnt] == s[i])
                Num1.pb(i), Cnt++;
            else
                Num2.pb(i);
        }
//        Build();
//        ll Last = -1;
//        ll Mx = -1;
//        for(int i = 0 ; i < n ; i++)
//        {
//            pair<int,int> Bla = Query(i, n - 1);
//            if(Bla.Sc <= Last)
//                break;
//            if(ss.sz > 0 && Bla.Fr > *ss.begin())
//                break;
//            if(i != Bla.Sc && Query(i, i) != make_pair(1000000, 1000000))
//                ss.insert(s[i] - '0');
//            Last = Bla.Sc;
//            Mem.pb(Bla.Fr);
//            Update(Bla.Sc, Bla.Sc);
//
//        }
//        int j = 0;
//        bool Done = false;
//        for(int i = 0 ; i < n ; i++)
//        {
//            if(s[i] - '0' == Mem[j] && !Done)
//            {
//                Num1.pb(i);
//                j++;
//            }
//            else
//                Num2.pb(i);
//            if(Mem.sz == j)
//            {
//                Done = true;
//            }
//        }
//        string Temp;
//        Temp.resize(n);
        int o = 0;
        int j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        Num1.clear();
        Num2.clear();
        Mem.clear();
        //ss.clear();
        cout << endl;

    }

}


#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
set<int> ss;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1000000, 1000000);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1000000)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        Tree[Now].Sc = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
        int Cnt = 0;
        string Temp = s;
        sort(Temp.begin(), Temp.end());
        for(int i = 0 ; i < s.sz ; i++)
        {
            if(Temp[Cnt] == s[i])
                Num1.pb(i), Cnt++;
            else
                Num2.pb(i);
        }
//        Build();
//        ll Last = -1;
//        ll Mx = -1;
//        for(int i = 0 ; i < n ; i++)
//        {
//            pair<int,int> Bla = Query(i, n - 1);
//            if(Bla.Sc <= Last)
//                break;
//            if(ss.sz > 0 && Bla.Fr > *ss.begin())
//                break;
//            if(i != Bla.Sc && Query(i, i) != make_pair(1000000, 1000000))
//                ss.insert(s[i] - '0');
//            Last = Bla.Sc;
//            Mem.pb(Bla.Fr);
//            Update(Bla.Sc, Bla.Sc);
//
//        }
//        int j = 0;
//        bool Done = false;
//        for(int i = 0 ; i < n ; i++)
//        {
//            if(s[i] - '0' == Mem[j] && !Done)
//            {
//                Num1.pb(i);
//                j++;
//            }
//            else
//                Num2.pb(i);
//            if(Mem.sz == j)
//            {
//                Done = true;
//            }
//        }
//        string Temp;
//        Temp.resize(n);
        int o = 0;
         int j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(o < Num1.sz && Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        Num1.clear();
        Num2.clear();
        Mem.clear();
//        ss.clear();
//        for(int i = 0 ; i < n * 4 + 8 ; i++)
//            Tree[i] = make_pair(0, 0);
        cout << endl;

    }

}


#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
set<int> ss;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1000000, 1000000);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1000000)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        Tree[Now].Sc = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
//        int Cnt = 0;
//        string Temp = s;
//        sort(Temp.begin(), Temp.end());
//        for(int i = 0 ; i < s.sz ; i++)
//        {
//            if(Temp[Cnt] == s[i])
//                Num1.pb(i), Cnt++;
//            else
//                Num2.pb(i);
//        }
        Build();
        ll Last = -1;
        ll Mx = -1;
        for(int i = 0 ; i < n ; i++)
        {
            pair<int,int> Bla = Query(i, n - 1);
            if(Bla.Sc <= Last)
                break;
            if(ss.sz > 0 && Bla.Fr > *ss.begin())
                break;
            if(i != Bla.Sc && Query(i, i) != make_pair(1000000, 1000000))
                ss.insert(s[i] - '0');
            Last = Bla.Sc;
            Mem.pb(Bla.Fr);
            Update(Bla.Sc, Bla.Sc);

        }
        int j = 0;
        bool Done = false;
        for(int i = 0 ; i < n ; i++)
        {
            if(j < Mem.sz && s[i] - '0' == Mem[j] && !Done)
            {
                Num1.pb(i);
                j++;
            }
            else
                Num2.pb(i);
            if(Mem.sz == j)
            {
                Done = true;
            }
        }
        string Temp;
        Temp.resize(n);
        int o = 0;
         j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(o < Num1.sz && Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        Num1.clear();
        Num2.clear();
        Mem.clear();
        ss.clear();
        for(int i = 0 ; i < n * 4 + 8 ; i++)
            Tree[i] = make_pair(0, 0);
        cout << endl;

    }

}


#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
#define _CRT_SECURE_NO_WARNINGS
typedef long long ll;
using namespace std;
int T;
int n;
string s;
pair<int,int> Tree[800200];
vector <int> Num1, Num2, Mem;
set<int> ss;
void Build(ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(Start == End)
    {
        Tree[Now].Fr = s[Start] - '0';
        Tree[Now].Sc = Start;
        return;
    }
    ll Mid = Start + End >> 1;
    Build(Now << 1, Start, Mid);
    Build(Now << 1 | 1, Mid + 1, End);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}

pair<int,int> Query(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1)
{
    if(End < i || Start > j)
        return make_pair(1000000, 1000000);
    if(Start >= i && End <= j)
        return Tree[Now];

    ll Mid = Start + End >> 1;
    pair<int,int> TryLeft = Query(i, j, Now << 1, Start, Mid);
    pair<int,int> TryRight = Query(i, j, Now << 1 | 1, Mid + 1, End);
    return min(TryLeft, TryRight);
}
void Update(ll i, ll j, ll Now = 1, ll Start = 0, ll End = n - 1, ll Val = 1000000)
{
    if(Start >= i && End <= j)
    {
        Tree[Now].Fr = Val;
        Tree[Now].Sc = Val;
        return ;
    }
    if(End < i || Start > j) return ;
    ll Mid = Start + End >> 1;
    Update(i, j, Now << 1, Start, Mid, Val);
    Update(i, j, Now << 1 | 1, Mid + 1, End, Val);
    Tree[Now] = min(Tree[Now << 1], Tree[Now << 1 | 1]);
}
int main()
{
    IOS
    cin >> T;
    while(T--)
    {
        cin >> n;
        cin >> s;
        Build();
        ll Last = -1;
        ll Mx = -1;
        for(int i = 0 ; i < n ; i++)
        {
            pair<int,int> Bla = Query(i, n - 1);
            if(Bla.Sc <= Last)
                break;
            if(i != Bla.Sc && Query(i, i) != make_pair(1000000, 1000000))
                ss.insert(s[i] - '0');
            if(ss.sz > 0 && Bla.Fr > *ss.begin())
                break;
            Last = Bla.Sc;
            Mem.pb(Bla.Fr);
            Update(Bla.Sc, Bla.Sc);

        }
        int j = 0;
        bool Done = false;
        for(int i = 0 ; i < n ; i++)
        {
            if(s[i] - '0' == Mem[j] && !Done)
            {
                Num1.pb(i);
                j++;
            }
            else
                Num2.pb(i);
            if(Mem.sz == j)
            {
                Done = true;
            }
        }
        string Temp;
        Temp.resize(n);
        int o = 0;
        j = 0;
        for(int i = 0 ; i < Num1.sz ; i++)
        {
            Temp[i] = s[Num1[i]];
        }
         j = Num1.sz;
        for(int i = 0 ; i < Num2.sz ; i++)
            Temp[j] = s[Num2[i]], j++;
        bool Ok = true;
        for(int i = 1 ; i < n ; i++)
        {
            int Last = Temp[i - 1] - '0';
            int Now = Temp[i] - '0';
            if(Last > Now)
            {
                Ok = false;
                break;
            }
        }
        if(!Ok)
            cout << "-";
        else
        {
            int o = 0, k = 0;
            for(int i = 0 ; i < n ; i++)
            {
                if(Num1[o] == i)
                {
                    cout << 1;
                    o++;
                }
                else
                {
                    cout << 2;
                    k++;
                }
            }
        }
        for(int i = 0 ; i < n * 4 + 7 ; i++)
            Tree[i] = make_pair(0, 0);
        Num1.clear();
        Num2.clear();
        Mem.clear();
        ss.clear();
        cout << endl;

    }

}


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t;
        cin>>t;

        while(t--)
        {

            int n,i;
            cin>>n;
            int a[n];
            string x;
            cin>>x;
            int h[10]={0};
            for(i=0;i<n;i++)
            {
                a[i]=x[i]-'0';
                h[a[i]]=1;
            }

            int c=1;
            for(i=0;i<10;i++)
            {
                if(h[i]==1)
                {
                    h[i]=c;
                    c++;
                }
            }
            int f=0;
            int j;
            for(i=0;i<n;i++)
            {
                a[i]=h[a[i]];
                if(a[i]==1&&f==0)
                {
                    j=i;
                    f=1;
                }
            }

            vector<int> s1,s2;

            s1.pb(a[j]);
            f=0;
            int color[n]={0};
            color[j]=1;
            int g=0;
            for(i=0;i<n;i++)
            {
                if(i==j)
                {
                    g=1;
                    continue;
                }
                if(g==0)
                {
                    if(s2.size()==0||s2[s2.size()-1]==a[i])
                    {
                        s2.pb(a[i]);
                        color[i]=2;
                    }
                    else if(s2[s2.size()-1]+1==a[i])
                    {
                        s2.pb(a[i]);
                        color[i]=2;
                    }
                    else
                    {
                        f++;
                        break;
                    }
                    continue;
                }

                if(a[i]==s1[s1.size()-1])
                    {
                        s1.pb(a[i]);
                        color[i]=1;
                    }
                else if(s2.size()==0||s2[s2.size()-1]==a[i])
                    {
                        s2.pb(a[i]);
                        color[i]=2;
                    }
                else if(s1[s1.size()-1]+1==a[i])
                    {
                        s1.pb(a[i]);
                        color[i]=1;
                    }
                else if(s2[s2.size()-1]+1==a[i])
                    {
                        s2.pb(a[i]);
                        color[i]=2;
                    }
                else
                    {
                        f++;
                        break;
                    }
            }

            if(f==1)
            {
                cout<<"-"<<endl;
                continue;
            }

            if(s2.size()==0)
            {
                for(i=0;i<n;i++)
                {
                    cout<<color[i];
                }
                cout<<endl;
            }
            else
            {
                if(s1[0]==1&&s2[0]==1)
                {
                    if(s1[s1.size()-1]==c-1)
                    {
                        for(i=0;i<n;i++)
                        {
                            if(color[i]==1)
                            cout<<2;
                            else
                                cout<<1;
                        }
                    }
                    else
                    {
                        for(i=0;i<n;i++)
                        {
                            cout<<color[i];
                        }
                    }
                    cout<<endl;
                }
                else
                {
                    if(s1[0]==1)
                    {
                        for(i=0;i<n;i++)
                        {
                            cout<<color[i];
                        }
                    }
                    else
                    {
                        for(i=0;i<n;i++)
                        {
                            if(color[i]==1)
                            cout<<2;
                            else
                            cout<<1;
                        }
                    }
                    cout<<endl;
                }
            }

        }
    return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t=0,l;
        cin>>l;

        while(t<l)
        {

            int n;
            cin>>n;
            int a[n];
            int z,i,j;
            string x;
            cin>>x;
            int h[10]={0};
            for(i=0;i<n;i++)
            {

                z=x[i]-'0';
                a[i]=z;
                h[a[i]]=1;
            }

            if(t==217)
                cout<<x;
            int c=1;
            for(i=0;i<10;i++)
            {
                if(h[i]==1)
                {
                    h[i]=c;
                    c++;
                }
            }
            for(i=0;i<n;i++)
            {
                a[i]=h[a[i]];
            }
            int color[n];
            mem(color,-1);
            int g;
            int f;
            g=a[n-1];
            color[n-1]=1;
            for(i=n-2;i>=0;i--)
            {

                  if(a[i]==g)
                  {
                    color[i]=1;
                  }
                  else if(a[i]==g-1)
                  {
                    color[i]=1;
                    g=a[i];
                  }
            }

            f=0;
            for(i=n-1;i>=0;i--)
            {
                if(color[i]==-1)
                {
                    if(f==0)
                    {
                        color[i]=2;
                        g=a[i];
                        f=1;
                        continue;
                    }
                    if(a[i]==g)
                    {
                       color[i]=2;
                    }
                    else if(a[i]==g-1)
                    {
                       color[i]=2;
                       g=a[i];
                    }

                }

            }
            f=0;
            for(i=0;i<n;i++)
            {
                if(color[i]==-1)
                {
                    f=1;
                    break;
                }
            }
            if(f==1)
            {
                cout<<"-"<<endl;
                t++;
                continue;
            }

            j=-1;
            g=0;f=0;
            for(i=0;i<n;i++)
            {
                if(a[i]==1)
                {
                    if(color[i]==1&&g==0)
                        g=1;
                    if(color[i]==2&&f==0)
                        f=1;
                }
            }
            c=c-1;
            if(g==1&&f==1)
            {
                for(i=0;i<n;i++)
                {
                    if(a[i]==c)
                    {
                        if(color[i]==2)
                        {
                            f=0;
                        }
                        else
                        {
                            g=0;
                        }
                        break;
                    }
                }

            }
            if(f==1)
            {
                for(i=0;i<n;i++)
                {
                    if(color[i]==1)
                        cout<<2;
                    else
                        cout<<1;
                }
                cout<<endl;
            }
            else
            {
                for(i=0;i<n;i++)
                    cout<<color[i];
                cout<<endl;
            }

            t++;
        }
    return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t=0,l;
        cin>>l;

        while(t<l)
        {

            int n;
            cin>>n;
            int a[n];
            int z,i,j;
            string x;
            cin>>x;
            int h[10]={0};
            for(i=0;i<n;i++)
            {

                z=x[i]-'0';
                a[i]=z;
                h[a[i]]=1;
            }

            int c=1;
            for(i=0;i<10;i++)
            {
                if(h[i]==1)
                {
                    h[i]=c;
                    c++;
                }
            }
            for(i=0;i<n;i++)
            {
                a[i]=h[a[i]];
            }
            int color[n];
            mem(color,-1);
            int g;
            int f;
            g=a[n-1];
            color[n-1]=1;
            for(i=n-2;i>=0;i--)
            {

                  if(a[i]==g)
                  {
                    color[i]=1;
                  }
                  else if(a[i]==g-1)
                  {
                    color[i]=1;
                    g=a[i];
                  }
            }

            f=0;
            for(i=n-1;i>=0;i--)
            {
                if(color[i]==-1)
                {
                    if(f==0)
                    {
                        color[i]=2;
                        g=a[i];
                        f=1;
                        continue;
                    }
                    if(a[i]==g)
                    {
                       color[i]=2;
                    }
                    else if(a[i]==g-1)
                    {
                       color[i]=2;
                       g=a[i];
                    }

                }

            }
            f=0;
            for(i=0;i<n;i++)
            {
                if(color[i]==-1)
                {
                    f=1;
                    break;
                }
            }
            if(f==1)
            {
                cout<<"-"<<endl;
                t++;
                continue;
            }

            j=-1;
            g=0;f=0;
            for(i=0;i<n;i++)
            {
                if(a[i]==1)
                {
                    if(color[i]==1&&g==0)
                        g=1;
                    if(color[i]==2&&f==0)
                        f=1;
                }
            }
            c=c-1;
            if(g==1&&f==1)
            {
                for(i=0;i<n;i++)
                {
                    if(a[i]==c)
                    {
                        if(color[i]==2)
                        {
                            f=0;
                        }
                        else
                        {
                            g=0;
                        }
                        break;
                    }
                }

            }
            if(f==1)
            {
                for(i=0;i<n;i++)
                {
                    if(color[i]==1)
                        cout<<2;
                    else
                        cout<<1;
                }
                cout<<endl;
            }
            else
            {
                for(i=0;i<n;i++)
                    cout<<color[i];
                cout<<endl;
            }

            t++;
        }
    return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t;
        cin>>t;

        while(t--)
        {

            int n;
            cin>>n;
            int a[n];
            int z,i,j;
            char x;
            int h[10]={0};
            for(i=0;i<n;i++)
            {
                cin>>x;
                z=x-'0';
                a[i]=z;
                h[a[i]]=1;
            }
            int c=1;
            for(i=0;i<10;i++)
            {
                if(h[i]==1)
                {
                    h[i]=c;
                    c++;
                }
            }
            for(i=0;i<n;i++)
            {
                a[i]=h[a[i]];
            }
            int color[n];
            mem(color,-1);
            int g;
            int f;
            g=a[n-1];
            color[n-1]=1;
            for(i=n-2;i>=0;i--)
            {

                  if(a[i]==g)
                  {
                    color[i]=1;
                  }
                  else if(a[i]==g-1)
                  {
                    color[i]=1;
                    g=a[i];
                  }
            }

            f=0;
            for(i=n-1;i>=0;i--)
            {
                if(color[i]==-1)
                {
                    if(f==0)
                    {
                        color[i]=2;
                        g=a[i];
                        f=1;
                        continue;
                    }
                    if(a[i]==g)
                    {
                       color[i]=2;
                    }
                    else if(a[i]==g-1)
                    {
                       color[i]=2;
                       g=a[i];
                    }

                }

            }
            f=0;
            for(i=0;i<n;i++)
            {
                if(color[i]==-1)
                {
                    f=1;
                    break;
                }
            }
            if(f==1)
            {
                cout<<"-"<<endl;
                continue;
            }
            j=-1;
            for(i=0;i<n;i++)
            {
                if(a[i]==1)
                {
                    j=i;
                    break;
                }
            }
            if(color[j]==2)
            {
                for(i=0;i<n;i++)
                {
                    if(color[i]==1)
                        cout<<2;
                    else
                        cout<<1;
                }
                cout<<endl;
            }
            else
            {
                for(i=0;i<n;i++)
                    cout<<color[i];
                cout<<endl;
            }

        }
    return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t;
        cin>>t;

        while(t--)
        {

            int n;
            cin>>n;
            int a[n];
            int z,i,j;
            char x;

            for(i=0;i<n;i++)
            {
                cin>>x;
                z=x-'0';
                a[i]=z;
            }

            int color[n];
            mem(color,-1);
            color[n-1]=1;
            int g=a[n-1];
            for(i=n-2;i>=0;i--)
            {
                if(a[i]==g)
                  {
                    color[i]=1;
                  }
                  else if(a[i]<g)
                  {
                    color[i]=1;
                    g=a[i];
                  }
            }

            int f=0;
            for(i=n-1;i>=0;i--)
            {
                if(color[i]==-1)
                {
                    if(f==0)
                    {
                        color[i]=2;
                        g=a[i];
                        f=1;
                        continue;
                    }
                    if(a[i]==g)
                    {
                    color[i]=2;
                    }
                    else if(a[i]<g)
                    {
                    color[i]=2;
                    g=a[i];
                    }

                }

            }
            f=0;
            for(i=0;i<n;i++)
            {
                if(color[i]==-1)
                {
                    f=1;
                    break;
                }
            }
            if(f==1)
            {
                cout<<"-"<<endl;
                continue;
            }
            g=10;
            j=-1;
            for(i=0;i<n;i++)
            {
                if(a[i]<g)
                {
                    g=a[i];
                    j=i;
                }
            }
            if(color[j]==2)
            {
                for(i=0;i<n;i++)
                {
                    if(color[i]==1)
                        cout<<2;
                    else
                        cout<<1;
                }
                cout<<endl;
            }
            else
            {
                for(i=0;i<n;i++)
                    cout<<color[i];
                cout<<endl;
            }

        }
    return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t;
        cin>>t;

        while(t--)
        {

            int n,i;
            cin>>n;
            int a[n];
            string x;
            cin>>x;
            int h[10]={0};
            for(i=0;i<n;i++)
            {
                a[i]=x[i]-'0';
                h[a[i]]=1;
            }

            int c=1;
            for(i=0;i<10;i++)
            {
                if(h[i]==1)
                {
                    h[i]=c;
                    c++;
                }
            }
            for(i=0;i<n;i++)
            {
                a[i]=h[a[i]];
            }

            vector<int> s1,s2;
            s1.pb(a[0]);
            int f=0;
            int color[n]={0};
            color[0]=1;
            for(i=1;i<n;i++)
            {
                if(a[i]==s1[s1.size()-1])
                    {
                        s1.pb(a[i]);
                        color[i]=1;
                    }
                else if(s2.size()==0||s2[s2.size()-1]==a[i])
                    {
                        s2.pb(a[i]);
                        color[i]=2;
                    }
                else if(s1[s1.size()-1]+1==a[i])
                    {
                        s1.pb(a[i]);
                        color[i]=1;
                    }
                else if(s2[s2.size()-1]+1==a[i])
                    {
                        s2.pb(a[i]);
                        color[i]=2;
                    }
                else
                    {
                        f++;
                        break;
                    }
            }

            if(f==1)
            {
                cout<<"-"<<endl;
                continue;
            }

            if(s2.size()==0)
            {
                for(i=0;i<n;i++)
                {
                    cout<<color[i];
                }
                cout<<endl;
            }
            else
            {
                if(s1[0]==1&&s2[0]==1)
                {
                    if(s1[s1.size()-1]==c-1)
                    {
                        for(i=0;i<n;i++)
                        {
                            if(color[i]==1)
                            cout<<2;
                            else
                                cout<<1;
                        }
                    }
                    else
                    {
                        for(i=0;i<n;i++)
                        {
                            cout<<color[i];
                        }
                    }
                    cout<<endl;
                }
                else
                {
                    if(s1[0]==1)
                    {
                        for(i=0;i<n;i++)
                        {
                            cout<<color[i];
                        }
                    }
                    else
                    {
                        for(i=0;i<n;i++)
                        {
                            if(color[i]==1)
                            cout<<2;
                            else
                            cout<<1;
                        }
                    }
                    cout<<endl;
                }
            }

        }
    return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define vii vector<vector<int>>
    #define vi vector<int>
    #define vP vector<pair<int,int>>
    #define P pair<int,int>
    #define case cout<<"Case #"<<h+1<<": ";h++;
    #define fi first
    #define se second
    #define mem(a,b) memset(a,b,sizeof(a))
    #define sf(n) scanf("%d", &n)
    #define sff(a,b) scanf("%d %d", &a, &b)
    #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
    #define pfn(n) printf("%d\n", n)
    #define pfs(n) printf("%d ", n)
    #define H (ll)(1e9+7)
    #define bg (ll)998244353

    bool* Seive(ll n,bool *p)//1 means prime
    {
        /*
         bool p[21];                    //write this in main()
        *p=Seive(20,p);   //replace 20 by the given value
        */

        mem(p,1);
        ll i,j;
        for(i=2;i<=n;i++)
        {
            if(p[i]==1)
            for(j=i*i;j<=n;j+=i)
            {
               p[j]=0;
            }
        }
        p[1]=0;
    return p;

    }

    ll gcd(ll a,ll b)
    {
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
    {
        if(y==0)
            return 1;
        else if(y%2==0)
        {
            return modexp((x*x)%H,y/2);
        }
        else
        {
            return (x*modexp((x*x)%H,(y-1)/2))%H;
        }
    }

    ll fact(ll n) //n!
    {
        ll f=1;
        for(ll i=2;i<=n;i++)
        {
            f=(i%H*f%H)%H;
        }
        return f;
    }

    ll nCr(ll n,ll r)
    {
      return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
    }
    void showlist(list <int> g)
    {
        list <int> :: iterator it;
        for(it = g.begin(); it != g.end(); ++it)
            cout <<*it<<" ";
        cout << '\n';
    }

    int main()
    {

        //IOS
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif

        int t=0,l;
        cin>>l;

        while(t<l)
        {

            int n;
            cin>>n;
            int a[n];
            int z,i,j;
            string x;
            cin>>x;
            int h[10]={0};
            for(i=0;i<n;i++)
            {

                z=x[i]-'0';
                a[i]=z;
                h[a[i]]=1;
            }
            if(t==112)
            {
                cout<<x<<endl;
                t++;
                continue;
            }
            int c=1;
            for(i=0;i<10;i++)
            {
                if(h[i]==1)
                {
                    h[i]=c;
                    c++;
                }
            }
            for(i=0;i<n;i++)
            {
                a[i]=h[a[i]];
            }
            int color[n];
            mem(color,-1);
            int g;
            int f;
            g=a[n-1];
            color[n-1]=1;
            for(i=n-2;i>=0;i--)
            {

                  if(a[i]==g)
                  {
                    color[i]=1;
                  }
                  else if(a[i]==g-1)
                  {
                    color[i]=1;
                    g=a[i];
                  }
            }

            f=0;
            for(i=n-1;i>=0;i--)
            {
                if(color[i]==-1)
                {
                    if(f==0)
                    {
                        color[i]=2;
                        g=a[i];
                        f=1;
                        continue;
                    }
                    if(a[i]==g)
                    {
                       color[i]=2;
                    }
                    else if(a[i]==g-1)
                    {
                       color[i]=2;
                       g=a[i];
                    }

                }

            }
            f=0;
            for(i=0;i<n;i++)
            {
                if(color[i]==-1)
                {
                    f=1;
                    break;
                }
            }
            if(f==1)
            {
                cout<<"-"<<endl;
                t++;
                continue;
            }
            j=-1;
            for(i=0;i<n;i++)
            {
                if(a[i]==1)
                {
                    j=i;
                    break;
                }
            }
            if(color[j]==2)
            {
                for(i=0;i<n;i++)
                {
                    if(color[i]==1)
                        cout<<2;
                    else
                        cout<<1;
                }
                cout<<endl;
            }
            else
            {
                for(i=0;i<n;i++)
                    cout<<color[i];
                cout<<endl;
            }

            t++;
        }
    return 0;
    }


        //Write correct codes,then there is no need to debug
        //Implement after solving several problems
        //                                  - GENNADY KOROTKEVICH

        #include<bits/stdc++.h>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        #define pb push_back
        #define mp make_pair
        #define ll long long
        #define int int64_t
        #define vii vector<vector<int>>
        #define vi vector<int>
        #define vP vector<pair<int,int>>
        #define P pair<int,int>
        #define case cout<<"Case #"<<hh+1<<": ";hh++;//int T;cin>>T;int hh=0;while(T--)
        #define fi first
        #define se second
        #define endl "\n"
        #define mem(a,b) memset(a,b,sizeof(a))
        #define sf(n) scanf("%d", &n)
        #define sff(a,b) scanf("%d %d", &a, &b)
        #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
        #define pfn(n) printf("%d\n", n)
        #define pfs(n) printf("%d ", n)
        #define H (ll)(1e9+7)
        #define bg (ll)998244353

        bool* Seive(ll n,bool *p)//1 means prime
        {
            /*
             bool p[21];                    //write this in main()
            *p=Seive(20,p);   //replace 20 by the given value
            */

            mem(p,1);
            ll i,j;
            for(i=2;i<=n;i++)
            {
                if(p[i]==1)
                for(j=i*i;j<=n;j+=i)
                {
                   p[j]=0;
                }
            }
            p[1]=0;
        return p;

        }

        ll gcd(ll a,ll b)
        {
            if(b==0)
                return a;
            else
                return gcd(b,a%b);
        }

        ll modexp(ll x,ll y) //x^y//Inverse modulo where y=H-2(use when H is prime)
        {
            if(y==0)
                return 1;
            else if(y%2==0)
            {
                return modexp((x*x)%H,y/2);
            }
            else
            {
                return (x*modexp((x*x)%H,(y-1)/2))%H;
            }
        }

        ll fact(ll n) //n!
        {
            ll f=1;
            for(ll i=2;i<=n;i++)
            {
                f=(i%H*f%H)%H;
            }
            return f;
        }

        ll nCr(ll n,ll r)
        {
          return (fact(n)*modexp((fact(n-r)*fact(r))%H,H-2))%H;
        }
        void showlist(list <int> g)
        {
            list <int> :: iterator it;
            for(it = g.begin(); it != g.end(); ++it)
                cout <<*it<<" ";
            cout << '\n';
        }

        // Segment tree Functions
        void build(int l,int r,int i)//array 'a[4*n+4]' is the segment tree
        {
            if(l==r)
            {
                //a[i]++;
            }
            else
            {
                int mid=(l+r)/2;
                build(l,mid,2*i);
                build(mid+1,r,2*i+1);
                //a[i]=a[2*i]+a[2*i+1];
            }
        }// int main() : build(0,n-1,1);
        void update(int p,int l,int r,int i)//update at position 'p'
        {
            if(l==r)
            {
                //a[i]--;
                //a[i]++;
            }
            else
            {
                int mid=(l+r)/2;
                if(p<=mid)
                {
                    update(p,l,mid,2*i);
                }
                else
                {
                    update(p,mid+1,r,2*i+1);
                }
                //a[i]--;
                //a[i]++;
            }
        }// in main(): update(p,0,n-1,1);
        void query(int y,int z,int l,int r,int i,int *d)//query: find ans for range y to z
        {
            if(y<=l&&z>=r)
             {
             }
            else
            {
                int mid=(l+r)/2;
                if(z<=mid)
                {
                    query(y,z,l,mid,2*i,d);
                }
                else if(y>mid)
                {
                    query(y,z,mid+1,r,2*i+1,d);
                }
                else
                {
                    query(y,z,l,mid,2*i,d);
                    query(y,z,mid+1,r,2*i+1,d);
                }
            }
        }// in main(): query(y,z,0,n-1,1);

    int32_t main()
        {

            IOS
            #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
            #endif

            int T,hh=0;
            cin>>T;
            while(T--)
            {
                int n,i;
                cin>>n;
                string s;
                cin>>s;

                int a[10]; mem(a,0);
                for(i=0;i<n;i++)
                {
                    a[(int)(s[i]-'0')]=1;
                }
                int h=0;
                for(i=0;i<10;i++)
                {
                    if(a[i]==1)
                    a[i]=h++;
                }
                h=h-1;
                vector<int> v;

                for(i=0;i<n;i++)
                {
                    v.pb(a[(int)(s[i]-'0')]);
                }

                int l[h+1]; mem(l,-1);
                int c[h+1]; mem(c,0);
                for(i=n-1;i>=0;i--)
                {
                    if(l[v[i]]==-1)
                    l[v[i]]=i;
                    c[v[i]]++;
                }
                int p[n]; mem(p,0);
                int act[h+1]; mem(act,0);
                int j=0;
                for(i=0;i<n;i++)
                {
                    if(v[i]==j)
                    {
                        p[i]=1;
                        c[j]--;
                    }
                    else
                    act[v[i]]=1;
                    if(i==l[j])
                    {
                        if(act[j]==1)
                            break;
                        j++;
                    }
                }

                for(i=0;i<n;i++)
                {
                    if(v[i]==j)
                    {
                        p[i]=2;
                        c[v[i]]--;
                    }
                    if(c[j]==0)
                    j++;
                }
                int f=0;
                for(i=0;i<n;i++)
                {
                    if(p[i]==0)
                    {
                        f=1;
                        break;
                    }
                }
                if(f==1)
                cout<<"-"<<endl;
                else
                {
                    for(i=0;i<n;i++)
                    {
                        cout<<p[i];
                    }
                    cout<<endl;
                }

            }

                return 0;
        }