#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
int head[maxn], nt[maxn], ver[maxn], d1[maxn], d2[maxn], tot = 0, np = 0;
char str[maxn];
int ans[maxn], q[maxn], d[maxn];
int res[maxn];
void add(int x, int y) {
  ver[++tot] = y, nt[tot] = head[x], head[x] = tot;
  d1[y]++;
  d2[y]++;
  d[y]++;
}
int dfs1(int x) {
  int ans = 0;
  int l = 1, r = 1;
  q[1] = x;
  while (l <= r) {
    int nx = q[l++];
    res[++ans] = nx;
    for (int i = head[nx]; i; i = nt[i]) {
      int y = ver[i];
      d1[y]--;
      if (d1[y] >= 0) q[++r] = y;
      d1[y] = 0;
    }
  }
  return ans;
}
int dfs2(int x) {
  int ans = 0;
  int l = 1, r = 1;
  q[1] = x;
  while (l <= r) {
    int nx = q[l++];
    res[++ans] = nx;
    for (int i = head[nx]; i; i = nt[i]) {
      int y = ver[i];
      d2[y]--;
      if (d2[y] == 0) q[++r] = y;
    }
  }
  return ans;
}
void bfs(int x, int now, int cnt) {
  for (int i = 1; i <= cnt; i++) ans[res[i]] = now + i;
}
int main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d%s", &n, str + 1);
    for (int i = 1; i <= n; i++) {
      head[i] = 0;
      d1[i] = 0;
      d2[i] = 0;
      d[i] = 0;
    }
    tot = 0;
    for (int i = 1; i < n; i++) {
      if (str[i] == '<')
        add(i, i + 1);
      else
        add(i + 1, i);
    }
    int now = n;
    for (int i = 1; i <= n; i++) {
      if (d[i] == 0) {
        int cnt = dfs1(i);
        now -= cnt;
        bfs(i, now, cnt);
      }
    }
    for (int i = 1; i <= n; i++) {
      if (i != 1) putchar(' ');
      printf("%d", ans[i]);
    }
    putchar('\n');
    now = 0;
    for (int i = 1; i <= n; i++) {
      if (d[i] == 0) {
        int cnt = dfs2(i);
        bfs(i, now, cnt);
        now += cnt;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (i != 1) putchar(' ');
      printf("%d", ans[i]);
    }
    putchar('\n');
  }
  return 0;
}
