#include <bits/stdc++.h>
const int maxn = 2e5 + 5;
using namespace std;
int n;
char a[maxn];
int ans1[maxn], ans2[maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %s", &n, a + 1);
    int num = 0, now = n, rn = 0;
    for (int i = 1; i < n; i++) {
      if (a[i] == '<') {
        num++;
      }
    }
    a[n] = '\0';
    rn = num;
    int cnt = 1;
    for (int i = 1; i < n; i++) {
      if (a[i] == '>') {
        ans1[i] = ans2[i] = now;
        now--;
      } else {
        int tm = 1, rt;
        while (a[i + tm] == '<') {
          tm++;
        }
        rt = tm;
        while (tm--) {
          ans1[i] = num - tm;
          ans2[i] = cnt;
          cnt++;
          i++;
        }
        num -= rt;
        i--;
      }
    }
    for (int i = 1; i < n; i++) {
      printf("%d ", ans1[i]);
    }
    printf("%d\n", rn + 1);
    for (int i = 1; i < n; i++) {
      printf("%d ", ans2[i]);
    }
    printf("%d\n", rn + 1);
  }
  return 0;
}
