#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n;
    string s;
    cin >> n >> s;
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) v[i] = (n - i);
    for (long long int i = 0; i < n - 1; i++) {
      long long int cnt = 0;
      if (s[i] == '<') {
        long long int idx = i;
        while (i < s.size() && s[i] == '<') i++;
        reverse(v.begin() + idx, v.begin() + i + 1);
        i--;
      }
    }
    for (long long int i : v) cout << i << " ";
    cout << '\n';
    for (long long int i = 0; i < n; i++) v[i] = i + 1;
    for (long long int i = 0; i < n - 1; i++) {
      long long int cnt = 0;
      if (s[i] == '>') {
        long long int idx = i;
        while (i < s.size() && s[i] == '>') i++;
        reverse(v.begin() + idx, v.begin() + i + 1);
        i--;
      }
    }
    for (long long int i : v) cout << i << " ";
    cout << '\n';
  }
}
