#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000007;
const long long maxn = 1e6 + 5;
const int mod = 1e9 + 7;
const double eps = 1e-8;
int in[maxn];
int vis[maxn];
char str[maxn];
long long dp[maxn];
vector<int> v[maxn];
long long n, m;
void solve1() {
  priority_queue<int, vector<int>, greater<int>> que;
  for (int i = 1; i <= n; i++) dp[i] = 0;
  for (int i = 1; i <= n; i++) vis[i] = in[i];
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) que.push(i);
  }
  long long cot = 0;
  while (!que.empty()) {
    int u = que.top();
    que.pop();
    dp[u] = max(dp[u], ++cot);
    int sz = v[u].size();
    for (int i = 0; i < sz; i++) {
      int e = v[u][i];
      dp[e] = max(dp[u] + 1, dp[e]);
      vis[e]--;
      if (!vis[e]) que.push(e);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", dp[i]);
}
void solve2() {
  priority_queue<int> que;
  for (int i = 1; i <= n; i++) dp[i] = 0;
  for (int i = 1; i <= n; i++) vis[i] = in[i];
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) que.push(i);
  }
  long long cot = 0;
  while (!que.empty()) {
    int u = que.top();
    que.pop();
    dp[u] = max(dp[u], ++cot);
    int sz = v[u].size();
    for (int i = 0; i < sz; i++) {
      int e = v[u][i];
      dp[e] = max(dp[u] + 1, dp[e]);
      vis[e]--;
      if (!vis[e]) que.push(e);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", dp[i]);
}
int main() {
  int _;
  scanf("%d", &_);
  while (_--) {
    scanf("%lld%s", &n, str + 1);
    for (int i = 1; i <= n; i++) in[i] = 0, v[i].clear();
    int len = strlen(str + 1);
    for (int i = 1; i <= len; i++) {
      if (str[i] == '<')
        v[i].push_back(i + 1), in[i + 1]++;
      else
        v[i + 1].push_back(i), in[i]++;
    }
    solve2();
    puts("");
    solve1();
    puts("");
  }
  return 0;
}
