#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  cin.ignore(1, '\n');
  while (t--) {
    int n;
    cin >> n;
    string s;
    getline(cin, s);
    if (s[n - 1] == '<') {
      s.push_back('>');
    } else {
      s.push_back('<');
    }
    int gt = 0;
    for (int i = 1; i <= n; i++) {
      if (s[i] == '>') gt++;
    }
    int hi = n, lo = n - gt;
    for (int i = 1; i <= n; i++) {
      if (s[i] == '>') {
        cout << hi-- << " ";
        continue;
      }
      int ct = 0;
      for (int j = i; j <= n; j++) {
        if (s[j] == '<')
          ct++;
        else
          break;
      }
      lo -= ct;
      i += ct - 1;
      for (int j = 1; j <= ct; j++) {
        cout << lo + j << " ";
      }
    }
    cout << endl;
    lo = 1, hi = n;
    for (int i = 1; i <= n; i++) {
      if (s[i] == '>') {
        cout << hi-- << " ";
        continue;
      } else {
        cout << lo++ << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
