#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> res(n, -1);
  int now = 1, cnt = 0;
  for (int i = n - 1 - 1; i >= 0; i--) {
    if (s[i] == '<') {
      ++cnt;
    }
    if (s[i] == '>') {
      for (int j = 0; j < cnt + 1; j++) {
        res[i + 1 + j] = now;
        ++now;
      }
      cnt = 0;
    }
  }
  if (cnt > 0) {
    for (int j = 0; j < cnt + 1; j++) {
      res[j] = now;
      ++now;
    }
    cnt = 0;
  }
  now = n;
  for (int i = 0; i < n; i++) {
    if (res[i] == -1) {
      res[i] = now;
      --now;
    }
  }
  for (int i = 0; i < n; i++) cout << res[i] << " ";
  cout << endl;
  vector<int> ans(n, -1);
  now = 1;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '<') {
      ans[i] = now;
      ++now;
      if (i == n - 2) {
        ans[i + 1] = now;
        ++now;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (ans[i] == -1) {
      ans[i] = now;
      ++now;
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) solve();
  return 0;
}
