#include <bits/stdc++.h>
using namespace std;
const int mn = 2e5 + 10;
char ch[mn];
int ans[mn];
int main() {
  int T = 1;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    scanf("%s", ch + 1);
    int now = n + 1;
    for (int i = 1; i <= n; i++) {
      if (i == n || ch[i] == '>') {
        ans[i] = --now;
      } else if (ch[i] == '<') {
        int j = i;
        for (;; j++) {
          if (j == n || ch[j] == '>') break;
        }
        for (int k = j; k >= i; k--) {
          ans[k] = --now;
        }
        i = j;
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d ", ans[i]);
    }
    printf("\n");
    now = 0;
    for (int i = 1; i <= n; i++) {
      if (i == n || ch[i] == '<') {
        ans[i] = ++now;
      } else if (ch[i] == '>') {
        int j = i;
        for (;; j++) {
          if (j == n || ch[j] == '<') break;
        }
        for (int k = j; k >= i; k--) {
          ans[k] = ++now;
        }
        i = j;
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d ", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
