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