#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    vector<long long> ans(n + 1);
    long long i, j;
    long long num = n, last = 0;
    for (i = 0; i < n; i++) {
      if (i == n - 1 || s[i] == '>') {
        for (j = i; j >= last; j--) ans[j] = num--;
        last = i + 1;
      }
    }
    for (i = 0; i < n; i++) cout << ans[i] << " \n"[i == n - 1];
    num = 1, last = 0;
    for (i = 0; i < n; i++) {
      if (i == n - 1 || s[i] == '<') {
        for (j = i; j >= last; j--) ans[j] = num++;
        last = i + 1;
      }
    }
    for (i = 0; i < n; i++) cout << ans[i] << " \n"[i == n - 1];
  }
  return 0;
}
