#include <bits/stdc++.h>
using namespace std;
int t, n, a[200005], cnt;
char k[200005];
int main() {
  scanf("%d", &t);
  for (int ci = 1; ci <= t; ci++) {
    scanf("%d%s", &n, k + 1);
    cnt = 0;
    for (int i = 1; i < n; i++)
      if (k[i] == '<') cnt++;
    cnt = n - cnt;
    a[1] = cnt--;
    for (int i = 1; i < n; i++)
      if (k[i] == '>') a[i + 1] = cnt--;
    cnt = n;
    for (int i = 1; i <= n; i++)
      if (k[i] == '<' && (i + 1 >= n || k[i + 1] == '>')) {
        for (int j = i; j > 0 && k[j] == '<'; j--) a[j + 1] = cnt--;
      }
    for (int i = 1; i <= n; i++) printf("%d ", a[i]);
    printf("\n");
    cnt = 0;
    for (int i = 1; i < n; i++)
      if (k[i] == '<') cnt++;
    a[n] = cnt + 1;
    for (int i = n - 1; i > 0; i--)
      if (k[i] == '<') a[i] = cnt--;
    cnt = n;
    for (int i = 1; i < n; i++)
      if (k[i] == '>') a[i] = cnt--;
    for (int i = 1; i <= n; i++) printf("%d ", a[i]);
    printf("\n");
  }
  return 0;
}
