#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<pair<int, int> > Ma, Me;
int t, n, cntma, cntme, pos, ptma, ptme, cnt, respma[N], respme[N];
string s;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> t;
  for (int j = 0; j < t; j++) {
    cin >> n >> s;
    Me.clear(), Ma.clear(), cntma = 0, cntme = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '>') {
        cntma++;
        if (i == s.size() - 1) Ma.push_back({i - cntma + 1, cntma}), cntma = 0;
        if (cntme != 0) Me.push_back({i - cntme, cntme}), cntme = 0;
      }
      if (s[i] == '<') {
        cntme++;
        if (i == s.size() - 1) Me.push_back({i - cntme + 1, cntme}), cntme = 0;
        if (cntma != 0) Ma.push_back({i - cntma, cntma}), cntma = 0;
      }
    }
    pos = 0, ptma = 0, ptme = 0, cnt = n;
    while (pos < n - 1) {
      if (ptma < Ma.size() && Ma[ptma].first == pos) {
        int i = pos, fim = Ma[ptma].second;
        if (pos + Ma[ptma].second == n - 1) fim++;
        if (pos != 0) i++;
        for (; i < pos + fim; i++) respma[i] = cnt, cnt--;
        pos += fim, ptma++;
      } else if (ptme < Me.size() && Me[ptme].first == pos) {
        for (int i = pos + Me[ptme].second; i >= pos; i--)
          respma[i] = cnt, cnt--;
        pos += Me[ptme].second, ptme++;
      }
    }
    for (int i = 0; i < n; i++) cout << respma[i] << " ";
    cout << "\n";
    pos = 0, ptma = 0, ptme = 0, cnt = 1;
    while (pos < n - 1) {
      if (ptme < Me.size() && Me[ptme].first == pos) {
        int i = pos, fim = Me[ptme].second;
        if (pos + Me[ptme].second == n - 1) fim++;
        if (pos != 0) i++;
        for (; i < pos + fim; i++) respme[i] = cnt, cnt++;
        pos += fim, ptme++;
      } else if (ptma < Ma.size() && Ma[ptma].first == pos) {
        for (int i = pos + Ma[ptma].second; i >= pos; i--)
          respme[i] = cnt, cnt++;
        pos += Ma[ptma].second, ptma++;
      }
    }
    for (int i = 0; i < n; i++) cout << respme[i] << " ";
    cout << "\n";
  }
}
