#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int q;
  cin >> q;
  long long int j;
  for (j = 1; j <= q; j++) {
    long long int n;
    cin >> n;
    string s;
    cin >> s;
    long long int c = 0, d = 0, start;
    long long int i;
    for (i = 0; i < n - 1; i++) {
      if (s[i] == '>')
        c++;
      else
        d++;
    }
    start = c + 1;
    vector<long long int> mini, maxi;
    long long int z = 0;
    long long int k, prev = n;
    for (i = 0; i < n - 1; i++) {
      if (s[i] == '>') {
        k = prev - z;
        for (long long int jj = k; jj <= prev; jj++) mini.push_back(jj);
        prev = k - 1;
        z = 0;
      } else {
        z++;
      }
    }
    if (s[n - 2] == '<') {
      k = prev - z;
      for (i = k; i <= prev; i++) {
        mini.push_back(i);
      }
      prev = k - 1;
    } else {
      mini.push_back(prev);
    }
    start = 200005;
    prev = 0;
    z = 0;
    for (i = 0; i < n - 1; i++) {
      if (s[i] == '>') {
        z++;
      } else {
        k = z + 1 + prev;
        for (long long int jj = k; jj >= prev + 1; jj--) {
          maxi.push_back(jj);
        }
        prev = k;
        z = 0;
      }
    }
    if (s[n - 2] == '>') {
      k = z + 1 + prev;
      for (i = k; i >= prev + 1; i--) {
        maxi.push_back(i);
      }
      prev = k;
    } else {
      maxi.push_back(prev + 1);
    }
    for (i = 0; i < mini.size(); i++) cout << mini[i] << " ";
    cout << endl;
    for (i = 0; i < maxi.size(); i++) cout << maxi[i] << " ";
    cout << endl;
  }
}
