#include <bits/stdc++.h>
using namespace std;
const int maxl = 200005;
int T, n, mk, seq[maxl];
char s[maxl];
inline char read() {
  char ch = getchar();
  while (ch != '<' && ch != '>') ch = getchar();
  return ch;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    mk = 0;
    memset(seq, 0, sizeof(seq));
    for (register int i = 1; i < n; i++) s[i] = read();
    s[0] = '>';
    s[n] = '<';
    for (register int i = n; i; i--)
      if (s[i - 1] == '>' && s[i] == '<') seq[i] = ++mk;
    mk = n;
    for (register int i = 1, j, tmp; i <= n; i++) {
      if (seq[i]) continue;
      if (s[i - 1] == '>')
        seq[i] = mk--;
      else {
        for (j = i; s[j] != '>' && j < n; j++)
          ;
        tmp = j;
        for (; j >= i; j--) seq[j] = mk--;
        i = tmp;
      }
    }
    for (register int i = 1; i <= n; i++) printf("%d ", seq[i]);
    printf("\n");
    memset(seq, 0, sizeof(seq));
    mk = 0;
    for (register int i = 1; i <= n; i++)
      if (s[i - 1] == '>' && s[i] == '<') seq[i] = ++mk;
    mk = n;
    for (register int i = n, j, tmp; i; i--) {
      if (seq[i]) continue;
      if (s[i] == '<')
        seq[i] = mk--;
      else {
        for (j = i; s[j - 1] != '<' && j > 1; j--)
          ;
        tmp = j;
        for (; j <= i; j++) seq[j] = mk--;
        i = tmp;
      }
    }
    for (register int i = 1; i <= n; i++) printf("%d ", seq[i]);
    printf("\n");
  }
  return 0;
}
