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