#include <bits/stdc++.h>
using namespace std;
char s[200005];
int ans[200005];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d %s", &n, s);
    int m = n;
    for (int i = 0; i < n; i++) {
      int len = 1;
      while (s[i] == '<' && i < n) {
        len++;
        i++;
      }
      for (int j = i; j >= i - len + 1; j--) ans[j] = m--;
    }
    for (int i = 0; i < n; i++) printf("%d ", ans[i]);
    printf("\n");
    m = 1;
    for (int i = 0; i < n; i++) {
      int len = 1;
      while (s[i] == '>' && i < n) {
        len++;
        i++;
      }
      for (int j = i; j >= i - len + 1; j--) ans[j] = m++;
    }
    for (int i = 0; i < n; i++) printf("%d ", ans[i]);
    printf("\n");
  }
  return 0;
}
