#include <bits/stdc++.h>
using namespace std;
const int MN = 2e5 + 7;
const int MOD = 1e9 + 7;
const long long INF = 4e18 + 7;
int n, mnans[MN], mxans[MN];
void slv() {
  cin >> n;
  string s;
  cin >> s;
  int zz = 1, po = n - 1;
  int wtf = 0;
  int cnt = 0;
  zz = 1;
  po = 0;
  cnt = 1;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '>') {
      zz++;
    } else {
      int w = 0;
      while (po <= i) {
        mnans[po] = zz - w;
        w++;
        po++;
      }
      zz++;
    }
  }
  int w = 0;
  while (po <= n - 1) {
    mnans[po] = zz - w;
    w++;
    po++;
  }
  reverse(s.begin(), s.end());
  zz = 1;
  po = 0;
  cnt = 1;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '<') {
      zz++;
    } else {
      int w = 0;
      while (po <= i) {
        mxans[po] = zz - w;
        w++;
        po++;
      }
      zz++;
    }
  }
  w = 0;
  while (po <= n - 1) {
    mxans[po] = zz - w;
    w++;
    po++;
  }
  for (int i = n - 1; i >= 0; i--) {
    cout << mxans[i] << ' ';
  }
  cout << endl;
  for (int i = 0; i < n; i++) {
    cout << mnans[i] << ' ';
  }
  cout << endl;
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    slv();
  }
}
