#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 7;
char s[N];
int arr[N];
void solve() {
  int n;
  cin >> n;
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) arr[i] = n - i + 1;
  for (int i = 1; i <= n - 1;) {
    int j = i;
    while (s[j] == '<') j++;
    reverse(arr + i, arr + 1 + j);
    i = j + 1;
  }
  for (int i = 1; i <= n; i++) cout << arr[i] << " ";
  cout << endl;
  for (int i = 1; i <= n; i++) arr[i] = i;
  for (int i = 1; i <= n - 1;) {
    int j = i;
    while (s[j] == '>') j++;
    reverse(arr + i, arr + 1 + j);
    i = j + 1;
  }
  for (int i = 1; i <= n; i++) cout << arr[i] << " ";
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
