#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string v;
    cin >> v;
    int val = n;
    int last = -1;
    vector<int> ans(n);
    for (int i = 0; i < n - 1; ++i) {
      if (v[i] == '>') {
        for (int j = i; j > last; --j) {
          ans[j] = val--;
        }
        last = i;
      }
    }
    int t = n;
    while (n - 1 > last) {
      ans[n - 1] = val--;
      n--;
    }
    n = t;
    for (auto& i : ans) cout << i << ' ';
    cout << '\n';
    ans = vector<int>(n);
    val = 1;
    last = -1;
    for (int i = 0; i < n - 1; ++i) {
      if (v[i] == '<') {
        for (int j = i; j > last; --j) {
          ans[j] = val++;
        }
        last = i;
      }
    }
    while (n - 1 > last) {
      ans[n - 1] = val++;
      n--;
    }
    for (auto& i : ans) cout << i << ' ';
    cout << '\n';
  }
  return 0;
}
