#include <bits/stdc++.h>
using namespace std;
const int INF = 3e5;
const int N = 2e5 + 10;
long long a[N], b[N], mir[N];
char s[N];
int n;
void lsan(long long *date) {
  for (int i = 1; i <= n; i++) mir[i] = date[i];
  sort(mir + 1, mir + n + 1);
  int m = unique(mir + 1, mir + n + 1) - mir - 1;
  for (int i = 1; i <= n; i++) {
    date[i] = lower_bound(mir + 1, mir + m + 1, date[i]) - mir;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> s + 2;
    a[1] = INF;
    b[1] = INF;
    for (int i = 2; i <= n; i++) {
      if (s[i] == '<') {
        a[i] = a[i - 1] + 1;
        b[i] = b[i - 1] + INF;
      } else {
        a[i] = a[i - 1] - INF;
        b[i] = b[i - 1] - 1;
      }
    }
    lsan(a);
    lsan(b);
    for (int i = 1; i <= n; i++) printf("%lld%c", a[i], i == n ? '\n' : ' ');
    for (int i = 1; i <= n; i++) printf("%lld%c", b[i], i == n ? '\n' : ' ');
  }
  return 0;
}
