#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1, ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
int T, n, a[200005], ans[200005], col[200005];
char s[200005];
signed main() {
  T = read();
  while (T--) {
    memset(col, 0, sizeof col);
    n = read(), scanf("%s", s + 2);
    a[1] = 1;
    register int cnt0 = 0, cnt1 = 0;
    for (int i = 2; i <= n; i++)
      if (s[i] == '<')
        a[i] = 1, cnt1++;
      else
        a[i] = 0, cnt0++;
    for (int i = 1; i <= n; i++)
      if (a[i]) {
        register int cnt = 0;
        while (a[i] && i <= n) cnt++, i++;
        i--;
        col[i] = cnt;
      }
    register int now = 1;
    for (int i = n; i > 0; i--)
      if (!a[i]) ans[i] = now, now++;
    now = n;
    for (int i = 1; i <= n; i++)
      if (col[i]) {
        for (int j = i; j >= i - col[i] + 1; j--) ans[j] = now, now--;
      }
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
    puts("");
    now = cnt0 + 1;
    for (int i = 1; i <= n; i++)
      if (a[i]) ans[i] = now, now++;
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
    puts("");
  }
  return 0;
}
