#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    int ress[n + 1];
    int resg[n + 1];
    int c = n, st = 0;
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '>') {
        for (int j = i; j >= st; j--) ress[j] = c--;
        st = i + 1;
      }
    }
    if (st != n) {
      for (int j = n - 1; j >= st; j--) ress[j] = c--;
    }
    c = 1, st = 0;
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '<') {
        for (int j = i; j >= st; j--) resg[j] = c++;
        st = i + 1;
      }
    }
    if (st != n) {
      for (int j = n - 1; j >= st; j--) resg[j] = c++;
    }
    for (int i = 0; i < n; i++) cout << ress[i] << " ";
    cout << endl;
    for (int i = 0; i < n; i++) cout << resg[i] << " ";
    cout << endl;
  }
}
