#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;
int n, pos, num;
char S[MAXN];
int Ans[MAXN];
int main() {
  int Ti;
  scanf("%d", &Ti);
  while (Ti--) {
    scanf("%d%s", &n, S + 1);
    num = n, pos = 1;
    for (int i = 1; i <= n; ++i)
      if (i == n || S[i] == '>') {
        for (int j = i; j >= pos; --j) Ans[j] = num--;
        pos = i + 1;
      }
    for (int i = 1; i <= n; ++i) printf("%d%c", Ans[i], " \n"[i == n]);
    num = 1, pos = 1;
    for (int i = 1; i <= n; ++i)
      if (i == n || S[i] == '<') {
        for (int j = i; j >= pos; --j) Ans[j] = num++;
        pos = i + 1;
      }
    for (int i = 1; i <= n; ++i) printf("%d%c", Ans[i], " \n"[i == n]);
  }
  return 0;
}
