#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int M = 1e9 + 7;
const long double PI = acos(-1);
int t, n;
char sgn[N];
int big[N], small[N];
void Test() {
  cin >> n;
  cin >> sgn + 1;
  int cntup = 1, cntdown = n, i, j;
  for (i = 1; i < n; i++)
    if (sgn[i] == '<')
      big[i] = cntup++;
    else
      big[i] = cntdown--;
  if (sgn[n - 1] == '>')
    big[n] = cntdown;
  else
    big[n] = cntup;
  int last = 1;
  cntup = n;
  for (i = 1; i <= n; i++)
    if (i == n || sgn[i] == '>') {
      for (j = i; j >= last; j--) small[j] = cntup--;
      last = i + 1;
    }
  for (i = 1; i <= n; i++) cout << small[i] << ' ';
  cout << '\n';
  for (i = 1; i <= n; i++) cout << big[i] << ' ';
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) Test();
  return 0;
}
