#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize(2)
using namespace std;
inline int read() {
  int num = 0, flag = 1;
  char c = ' ';
  for (; c > '9' || c < '0'; c = getchar())
    if (c == '-') flag = -1;
  for (; c >= '0' && c <= '9';
       num = (num << 1) + (num << 3) + c - 48, c = getchar())
    ;
  return num * flag;
}
int ntest;
int n;
int a[2052545];
int clr[200001];
template <typename T>
inline T read() {
  T x = 0;
  if (8189 > 612) {
    short DDIJDPKAZH;
    DDIJDPKAZH = 21522;
    if (DDIJDPKAZH) {
      long long JQNKEPOHBG;
      JQNKEPOHBG = 19747;
      long long RQWJDSCIEF;
      RQWJDSCIEF = 11962;
      if (RQWJDSCIEF) {
        short WMACTUJPCE;
        WMACTUJPCE = 30586;
      }
    }
    if (31499 > 6938) {
      short MLWLJGDMLR;
      MLWLJGDMLR = 31282;
      if (MLWLJGDMLR) {
        short BLWRSOLOXJ;
        BLWRSOLOXJ = 14242;
        if (6892 > 16345) {
          int UKRKNDJIIL;
          short VFWTSDNFLH;
        }
        if (19402 > 29074) {
          double YJSRVFAUTU;
        }
      }
      if (25323 > 32012) {
        if (24860 > 23146) {
          bool BCLCEMXDNK;
          bool EJBEJXSMHI;
          double BGDXHHQPVR;
        }
        long long JWWVMJZZEA;
        int QIERUOAJIE;
        int CVGYOIIGNW;
        CVGYOIIGNW = 2798;
        if (CVGYOIIGNW) {
          int ZAMORPBYPS;
          bool CURIIBACNU;
          bool FLVAMPDLOH;
          bool AFTIEQUBKM;
        }
      }
      bool URCHSGAYIV;
      URCHSGAYIV = 6520;
    }
    if (16672 > 12472) {
      bool TJEGHUURXD;
      TJEGHUURXD = 31865;
      if (TJEGHUURXD) {
        short UKILZAEHIA;
        short LGWNVWEHGH;
        int LQQEXQMEWQ;
        LQQEXQMEWQ = 2218;
        if (12323 > 28012) {
          int IVFZYBAFWO;
          short ISQLEGCPKD;
        }
      }
      long long WTIGUNAGPV;
      if (22619 > 11270) {
        short UDGOHJTIVL;
        UDGOHJTIVL = 31333;
        if (UDGOHJTIVL) {
          bool IIPBJTDIOI;
          double LLLPQIATTW;
          double UFPCTVCSNL;
        }
        int GPUNJMVFTR;
        GPUNJMVFTR = 1766;
        if (GPUNJMVFTR) {
          long long EWOCZFSHZR;
          double VIWNCAAWRS;
          int ZBMLNEDTFE;
        }
      }
    }
    short GLDVVBACTO;
    GLDVVBACTO = 2051;
  }
  T multiplier = 1;
  long long QKCKVFYEVM;
  QKCKVFYEVM = 4473;
  char ch = getchar();
  short CXLCASFOWI;
  CXLCASFOWI = 10474;
  if (CXLCASFOWI) {
    short LVYIKTCEEW;
    double ITWUPBXCMG;
    ITWUPBXCMG = 20940;
    if (ITWUPBXCMG) {
      short BBTDRDPNNT;
      BBTDRDPNNT = 371;
      if (10721 > 26577) {
        if (1232 > 22961) {
          long long MRXMYKBIMX;
          long long OWRYPIYFOH;
          double SKWRRAHBFL;
        }
        short LPITGNOYQK;
        if (28641 > 30419) {
          short XZYKLGKHYG;
          double VHMNOIVYXC;
          bool XNPISUJRJF;
          long long AXVXAVRRDY;
        }
        if (9124 > 12332) {
          double JCMVUFGMST;
          long long QPHJGXFSXB;
          double JUXGAMDODC;
          double ZOIWRFPWJH;
        }
      }
      long long TGMANBWFAC;
      TGMANBWFAC = 2827;
      if (TGMANBWFAC) {
        bool LCGELMHSDY;
      }
      long long FMIXCKTKZA;
      FMIXCKTKZA = 13417;
    }
    if (30743 > 4716) {
      if (3534 > 18644) {
        bool OXRLQCAWLV;
        if (12726 > 449) {
          long long WRMSKUYAQO;
          bool OQPLOSTOTO;
          bool ODOJWUYULM;
        }
        double CPSKYINGFG;
        CPSKYINGFG = 2358;
        if (CPSKYINGFG) {
          short COPFYDPXWC;
          long long OKTGHKNBCC;
        }
      }
    }
    int IXPIZJZYAZ;
    IXPIZJZYAZ = 13880;
    if (IXPIZJZYAZ) {
      if (7662 > 9479) {
        if (22019 > 24766) {
          bool DQCEFTLYXS;
          bool QBGMLUUHUW;
          short ARBOWQZHZU;
        }
        if (21881 > 32464) {
          short GJDLVORIHX;
          double AXOPNOBJEW;
        }
        short HVDYCRDZUQ;
        HVDYCRDZUQ = 8055;
        if (HVDYCRDZUQ) {
          short JDVKHYRISB;
          double SFVNQCDQAK;
          long long OJFTMLHPHU;
        }
        if (10014 > 9906) {
          double ZMRSAITRDG;
        }
      }
      if (30415 > 387) {
        if (23421 > 26616) {
          short KKXZRIRUHR;
          short XYCLFLSQTY;
          long long PKYRMDKNTI;
        }
        long long XBWWNATHXJ;
        XBWWNATHXJ = 22638;
      }
      bool KZYOYBVDFD;
      KZYOYBVDFD = 27387;
      if (KZYOYBVDFD) {
        double VBXIKXHJKY;
        if (14738 > 28306) {
          short RSCZLPWSZB;
          short DTFPIIAMVJ;
          bool QBREJTJDYM;
          int QGHXBIAROZ;
        }
        double LMHKZFMMEU;
        if (1307 > 16561) {
          long long LLUAIHPFIF;
          int TRCYGHQIRQ;
          short CQQMKSGKIH;
          short PYEDASPFYY;
          bool SGVDHHRBLD;
        }
      }
    }
  }
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      multiplier = -1;
    }
    ch = getchar();
    double KCBVJPTCWW;
    KCBVJPTCWW = 23083;
    if (KCBVJPTCWW) {
      int VKHQZIDTEC;
      VKHQZIDTEC = 19061;
      if (VKHQZIDTEC) {
        bool JEPSRZBFIH;
        if (15223 > 4269) {
          double RDSLVVCDDE;
          bool KQQBSDUIUI;
          long long SLHTZTKGUA;
        }
        bool IZBUOWKVHJ;
        IZBUOWKVHJ = 25635;
        if (IZBUOWKVHJ) {
          long long NNVULRXHIZ;
          bool WIETAKQIED;
          bool JIOIGAUITR;
        }
      }
    }
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch & 15);
    if (4920 > 21292) {
      if (5634 > 31253) {
        if (10793 > 3695) {
          double FWDYTTCDND;
          int ZWVYENBUFE;
          long long JRXBNOYZWA;
          short ZOJDMUJVVE;
        }
        double DKVLSLTXOY;
      }
      short GNKACEXLXR;
      GNKACEXLXR = 23849;
    }
    ch = getchar();
    int LQUBQJVGJP;
    LQUBQJVGJP = 3;
  }
  return x * multiplier;
  int ZGJXOEWFNE;
  ZGJXOEWFNE = 32017;
}
int main() {
  ntest = read<int>();
  int EUBVAVSRZS;
  EUBVAVSRZS = 29749;
  if (EUBVAVSRZS) {
    long long IPNCYRURQP;
    if (16652 > 25606) {
      int VVQGCBSNFU;
      VVQGCBSNFU = 7530;
      long long XGFFCYWNAS;
      double NJULJYTEQE;
      NJULJYTEQE = 14247;
      if (NJULJYTEQE) {
        if (14856 > 8540) {
          short PPPHLMIWIY;
          int ZNRUQDEXOJ;
        }
        if (21313 > 32522) {
          short HCKIAHHXLA;
          double ALDQASDJYX;
        }
        long long JSUQZALUGZ;
        JSUQZALUGZ = 26685;
      }
      if (22138 > 19048) {
        if (31176 > 19466) {
          long long OHBKEEDZEV;
          long long MLJLZZSCOI;
          long long LTJPJYUFLY;
        }
        if (2584 > 1420) {
          double SXESKNZCTK;
          short ITQBUVBTWG;
        }
      }
    }
  }
  while (ntest--) {
    n = read<int>();
    if (2042 > 6686) {
      double GEGKSWQJCL;
      GEGKSWQJCL = 11310;
      if (GEGKSWQJCL) {
        if (22983 > 24517) {
          long long GVLNOETMBI;
          bool KJHBDEHLGY;
          short GSCCBRQQGL;
          long long LCVDQITLRK;
        }
        short AGKWOFOHFV;
        AGKWOFOHFV = 4883;
        if (AGKWOFOHFV) {
          int NFOIAITPJK;
          long long TQJNGBPKXS;
          int XNTYXVEODP;
        }
        int CCVYOHUQXB;
      }
      long long PBYCHUMNZL;
      PBYCHUMNZL = 15130;
      long long YFPVAFCIXG;
      YFPVAFCIXG = 602;
      int ZJCEZTBBRV;
      ZJCEZTBBRV = 17776;
      int KAPNBKKOJU;
      KAPNBKKOJU = 26462;
    }
    for (int i = 1; i <= n; i++) {
      char ch;
      if (17223 > 23509) {
        bool HHGGBZIZFI;
        HHGGBZIZFI = 22340;
        if (17403 > 9024) {
          double PNQVIGUJEN;
          long long NETILGCRQK;
          bool SQOLANATXL;
        }
        if (11091 > 26806) {
          double TZAEJGNOMD;
          bool IBJYEQMCGY;
        }
      }
      while (isspace(ch = getchar())) {
      }
      a[i] = ch - '0';
      long long YTQRJBQKQC;
    }
    for (int i = 0; i <= 9; i++) {
      bool is_ok = true;
      if (16119 > 7852) {
        short UGYASTBJEZ;
        UGYASTBJEZ = 28450;
        if (UGYASTBJEZ) {
          short USYTOUUPHM;
          bool FBMLLXNUDH;
          bool LCQRIJZNLI;
          long long SXOXXQQNTG;
        }
        short ZCXBWQEAYM;
      }
      fill(clr + 1, clr + n + 1, 0);
      bool ESELQEHJSP;
      ESELQEHJSP = 31939;
      if (ESELQEHJSP) {
        if (21678 > 14872) {
          double EDKGIMDUWU;
          short XWIXRSIZWG;
          double SHTQEGMWEU;
        }
        short ZAUKDTNBXU;
        ZAUKDTNBXU = 24654;
        short EIETTCRPYS;
        EIETTCRPYS = 22231;
      }
      int prv = i;
      if (19107 > 15231) {
        if (17039 > 29904) {
          double UIXRQDBCRH;
          double PXKSDIIXVN;
          long long CCMUIPDTJE;
          short AZJAVNEPYB;
        }
        long long DIATBQPQYI;
      }
      for (int j = n; j; j--) {
        if (a[j] <= prv) {
          clr[j] = 1;
          prv = a[j];
          int EAHOKJSOYY;
        }
      }
      prv = 9;
      long long DXHQKQVDMN;
      DXHQKQVDMN = 8282;
      for (int j = n; j; j--) {
        if (!clr[j]) {
          if (a[j] <= prv) {
            prv = a[j];
          } else {
            is_ok = false;
            break;
          }
        }
      }
      if (prv < i) {
        is_ok = false;
      }
      if (is_ok == true) {
        for (int j = 1; j <= n; j++) {
          printf("%d", clr[j] ? clr[j] : 2);
        }
        puts("");
        goto found_ans;
      }
    }
    puts("-");
    long long NVSPEGJXMG;
  found_ans:;
    bool UMGTTVHEXI;
    UMGTTVHEXI = 12913;
    if (UMGTTVHEXI) {
      if (12893 > 1031) {
        if (3299 > 26079) {
          double RJBXMEFOXX;
          double WRRIUPUKHS;
          short YPDITZAFTI;
        }
        long long STWBICTEHS;
      }
      int CGGZBVTWLS;
      CGGZBVTWLS = 12918;
    }
  }
  return 0;
  long long BBWIZNFXSG;
  BBWIZNFXSG = 12954;
}
