#include <bits/stdc++.h>
using namespace std;
void test() {
  int n;
  scanf("%d ", &n);
  char* a = new char[n];
  scanf("%s", a);
  int* high = (int*)calloc(n, sizeof(int));
  int id = 1;
  for (int i = n - 1; i--;)
    if (a[i] == '>') high[i + 1] = id++;
  for (int i = 0; i < n; i++) {
    if (high[i]) continue;
    high[i] = id++;
  }
  int* low = (int*)calloc(n, sizeof(int));
  int c = 0, upbnd = n;
  for (int i = 0; i < n; i++) {
    c++;
    if (i == n - 1 || a[i] == '>') {
      for (int j = 0; j < c; j++) low[i - j] = upbnd--;
      c = 0;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", low[i]);
  printf("\n");
  for (int i = 0; i < n; i++) printf("%d ", high[i]);
  printf("\n");
}
int main() {
  int q;
  cin >> q;
  while (q--) test();
}
