#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
template <class T>
inline void read(T &res) {
  char c;
  T flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') res = res * 10 + c - '0';
  res *= flag;
}
int t, n, a[N], b[N];
string s;
void solve() {
  read(n);
  cin >> s;
  int m = n;
  for (int i = 0; i < n; i++) {
    int len = 1;
    while (i < s.length() && s[i] == '<') {
      len++;
      i++;
    }
    for (int j = i; j > i - len; j--) a[j] = m, m--;
  }
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  cout << endl;
  m = 1;
  for (int i = 0; i < n; i++) {
    int len = 1;
    while (i < s.length() && s[i] == '>') {
      len++;
      i++;
    }
    for (int j = i; j > i - len; j--) b[j] = m, m++;
  }
  for (int i = 0; i < n; i++) printf("%d ", b[i]);
  cout << endl;
}
int main() {
  read(t);
  while (t--) {
    solve();
  }
  return 0;
}
