#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int a[MAXN];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int N, cnt = 0;
    string s;
    cin >> N >> s;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '<') cnt++;
    }
    stack<int> ss;
    int res = N, k = cnt;
    for (int i = 0; i < N - 1; i++) {
      if (s[i] == '<') {
        ss.push(i);
      } else {
        a[i] = res--;
        while (!ss.empty()) {
          int id = ss.top();
          ss.pop();
          a[id] = cnt--;
        }
      }
    }
    a[N - 1] = res;
    while (!ss.empty()) {
      int id = ss.top();
      ss.pop();
      a[id] = cnt--;
    }
    for (int i = 0; i < N; i++) cout << a[i] << " ";
    cout << endl;
    cnt = k;
    stack<int> qq;
    res = cnt + 1;
    int x = 1;
    for (int i = 0; i < N; i++) {
      if (i == s.length()) {
        qq.push(i);
      } else {
        if (s[i] == '>') {
          qq.push(i);
        } else {
          while (!qq.empty()) {
            int dd = qq.top();
            qq.pop();
            a[dd] = res++;
          }
          a[i] = x++;
        }
      }
    }
    while (!qq.empty()) {
      int dd = qq.top();
      qq.pop();
      a[dd] = res++;
    }
    for (int i = 0; i < N; i++) cout << a[i] << " ";
    cout << endl;
  }
  return 0;
}
