#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
const int INF = 2000000010;
int n, m, t;
vector<int> G[maxn];
int in[maxn], cnt = 0, in2[maxn];
int a1[maxn], a2[maxn];
int vis[maxn];
void dfs(int *a, int u) {
  a[u] = ++cnt;
  vis[u] = 1;
  for (int i = 0; i < (int)G[u].size(); i++) {
    in[G[u][i]]--;
    if (in[G[u][i]] == 0) dfs(a, G[u][i]);
  }
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    cnt = 0;
    memset(in, 0, sizeof(in));
    for (int i = 1; i <= n; i++) G[i].clear();
    for (int i = 2; i <= n; i++) {
      char c;
      scanf(" %c", &c);
      if (c == '<')
        G[i - 1].push_back(i), in[i]++;
      else
        G[i].push_back(i - 1), in[i - 1]++;
    }
    memset(vis, 0, sizeof(vis));
    memcpy(in2, in, sizeof(in));
    for (int i = n; i >= 1; i--) {
      if (!vis[i] && in[i] == 0) {
        dfs(a1, i);
      }
    }
    cnt = 0;
    memcpy(in, in2, sizeof(in2));
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) {
      if (!vis[i] && in[i] == 0) {
        dfs(a2, i);
      }
    }
    for (int i = 1; i <= n; i++) printf("%d ", a1[i]);
    printf("\n");
    for (int i = 1; i <= n; i++) printf("%d ", a2[i]);
    printf("\n");
  }
  return 0;
}
