#include <bits/stdc++.h>
using namespace std;
int length;
char compare[200005];
int min_lis[200005], max_lis[200005];
void find_min() {
  int start = 1;
  int runner = length;
  int mem = 0;
  while (start <= length) {
    int counter = 1;
    while (start < length && compare[start] == '<') start++, counter++;
    for (int i = runner - counter + 1; i <= runner; i++) min_lis[++mem] = i;
    start++;
    runner -= counter;
  }
}
void find_max() {
  int mem = 0;
  int start = 1;
  int runner = 1;
  while (start <= length) {
    int counter = 1;
    while (start < length && compare[start] == '>') start++, counter++;
    for (int i = runner + counter - 1; i >= runner; i--) max_lis[++mem] = i;
    runner += counter;
    start++;
  }
}
void solve() {
  scanf("%d %s", &length, compare + 1);
  find_min();
  find_max();
  for (int i = 1; i <= length; i++) printf("%d ", min_lis[i]);
  printf("\n");
  for (int i = 1; i <= length; i++) printf("%d ", max_lis[i]);
  printf("\n");
}
int main() {
  int tester;
  scanf("%d", &tester);
  while (tester--) solve();
}
