#include <bits/stdc++.h>
using namespace std;
void shortest(string s, int n) {
  int tab[200005], len = n, y = 0, j;
  for (int i = 0; i < len; i++) {
    if (s[i] == '>') {
      tab[i] = n--;
      j = i;
      while (y--) tab[--j] = n--;
      y = 0;
    } else
      y++;
  }
  for (int i = 0; i < len; i++) cout << tab[i] << " ";
  cout << endl;
}
void longest(string s, int n) {
  int tab[200005], len = n, y = 0, j, n2 = 1;
  for (int i = 0; i < len; i++) {
    if (s[i] == '<') {
      tab[i] = n2++;
      j = i;
      while (y--) tab[--j] = n2++;
      y = 0;
    } else
      y++;
  }
  for (int i = 0; i < len; i++) cout << tab[i] << " ";
  cout << endl;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  shortest(s + ">", n);
  longest(s + "<", n);
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
