#include <bits/stdc++.h>
using namespace std;
using namespace std;
vector<int> aa, bb;
char s[200005], t[200005];
int a[200005], b[200005];
int n, m;
void doit() {
  scanf("%d%s", &n, s + 1);
  for (int i = 1; i <= n; i++)
    if (s[i] == '<')
      t[i] = '>';
    else
      t[i] = '<';
  t[0] = '<';
  int j = n - 1;
  int q = n;
  while (j >= 0) {
    int jj = j;
    while (t[j] == '>') j--;
    a[j + 1] = q--;
    for (int k = j + 1; k <= jj; k++) a[k + 1] = q--;
    j--;
  }
  s[0] = '<';
  j = n - 1;
  q = n;
  while (j >= 0) {
    int jj = j;
    while (s[j] == '>') j--;
    b[j + 1] = q--;
    for (int k = j + 1; k <= jj; k++) b[k + 1] = q--;
    j--;
  }
  for (int i = 1; i <= n; i++)
    printf("%d%c", n + 1 - a[i], (i == n) ? '\n' : ' ');
  for (int i = 1; i <= n; i++) printf("%d%c", b[i], (i == n) ? '\n' : ' ');
}
int main() {
  int cas;
  scanf("%d", &cas);
  while (cas--) doit();
}
