#include <bits/stdc++.h>
using namespace std;
int n;
int chuto[200005], boro[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
      chuto[i] = n - i;
      boro[i] = i + 1;
    }
    int j = 0;
    for (int i = 0; i < s.size(); i = j) {
      while (j < n && s[i] == s[j]) j++;
      if (s[i] == '<') {
        reverse(chuto + i, chuto + j + 1);
      } else {
        reverse(boro + i, boro + j + 1);
      }
    }
    for (int i = 0; i < n; i++) {
      cout << chuto[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < n; i++) {
      cout << boro[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
