#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
vector<int> G[maxn];
char s[maxn];
int vis[maxn];
map<string, int> mp;
long long a[maxn], n, L, R, t;
void solve1() {
  L = 0, R = n;
  for (int i = 0; i <= n - 2; i++) {
    if (s[i] == '<')
      L++;
    else {
      for (int i = R - L; i <= R; i++) printf("%d ", i);
      R = R - L - 1, L = 0;
    }
  }
  for (int i = R - L; i <= R && i >= 1; i++) printf("%d ", i);
  printf("\n");
}
void solve2() {
  L = 0, R = 1;
  for (int i = 0; i <= n - 2; i++) {
    if (s[i] == '>')
      L++;
    else {
      for (int i = R + L; i >= R; i--) printf("%d ", i);
      R = R + L + 1, L = 0;
    }
  }
  for (int i = R + L; i >= R && i <= n; i--) printf("%d ", i);
  printf("\n");
}
int main() {
  cin >> t;
  while (t--) {
    scanf("%lld%s", &n, s);
    solve1();
    solve2();
  }
}
