#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e+5;
char str[2 * maxn + 5];
int main() {
  int cishu;
  cin >> cishu;
  while (cishu--) {
    int n;
    cin >> n;
    for (int a = 0; a < n - 1; a++) cin >> str[a];
    str[n - 1] = '0';
    int tmp = n;
    for (int i = 0; i < n; i++) {
      if (str[i] == '<') {
        int amt = 2;
        for (int a = i + 1; a < n; a++) {
          if (str[a] == '<')
            amt++;
          else
            break;
        }
        int print = tmp - amt + 1;
        tmp = print - 1;
        for (int b = 0; b < amt; b++)
          printf("%d%c", print++, i + b == n - 1 ? '\n' : ' ');
        i = i + amt - 1;
      } else
        printf("%d%c", tmp--, i == n - 1 ? '\n' : ' ');
    }
    tmp = 1;
    for (int i = 0; i < n; i++) {
      if (str[i] == '>') {
        int amt = 2;
        for (int a = i + 1; a < n; a++) {
          if (str[a] == '>')
            amt++;
          else
            break;
        }
        int print = tmp + amt - 1;
        tmp = print + 1;
        for (int b = 0; b < amt; b++)
          printf("%d%c", print--, i + b == n - 1 ? '\n' : ' ');
        i = i + amt - 1;
      } else
        printf("%d%c", tmp++, i == n - 1 ? '\n' : ' ');
    }
  }
  return 0;
}
