#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
vector<int> G[MAXN];
int du1[MAXN], ans1[MAXN], du2[MAXN], ans2[MAXN];
int main() {
  int T;
  scanf("%d", &T);
  while (T-- > 0) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; ++i) {
      char s = getchar();
      while (s != '<' && s != '>') s = getchar();
      if (s == '<') {
        G[i + 1].push_back(i);
        du1[i]++;
        du2[i]++;
      } else {
        G[i].push_back(i + 1);
        du1[i + 1]++;
        du2[i + 1]++;
      }
    }
    priority_queue<int, vector<int>, greater<int> > q1;
    priority_queue<int, vector<int>, less<int> > q2;
    for (int i = 1; i <= n; ++i) {
      if (!du1[i]) q1.push(i);
      if (!du2[i]) q2.push(i);
    }
    int tot = n;
    while (!q1.empty()) {
      int x = q1.top();
      q1.pop();
      ans1[x] = tot;
      for (int i = 0; i < G[x].size(); ++i) {
        du1[G[x][i]]--;
        if (!du1[G[x][i]]) q1.push(G[x][i]);
      }
      x = q2.top();
      q2.pop();
      ans2[x] = tot;
      tot--;
      for (int i = 0; i < G[x].size(); ++i) {
        du2[G[x][i]]--;
        if (!du2[G[x][i]]) q2.push(G[x][i]);
      }
    }
    for (int i = 1; i <= n; ++i) printf("%d ", ans1[i]);
    putchar('\n');
    for (int i = 1; i <= n; ++i) printf("%d ", ans2[i]);
    putchar('\n');
    for (int i = 1; i <= n; ++i) ans1[i] = ans2[i] = du1[i] = du2[i] = 0;
    memset(G, 0, sizeof G);
  }
  return 0;
}
