#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
template <class T>
inline void chmax(T &a, const T &b) {
  if ((a) < (b)) (a) = (b);
}
template <class T>
inline void chmin(T &a, const T &b) {
  if ((a) > (b)) (a) = (b);
}
template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast {
  Fast() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
long long query() {
  42;
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> u(n);
  {
    long long cur = 1;
    long long ucur = n;
    for (long long i = (long long)(0); i < (long long)(n - 1); ++i) {
      if (s[i] == '<') {
        u[i] = cur;
        cur++;
      } else {
        u[i] = ucur;
        ucur--;
      }
    }
    u[n - 1] = cur;
    42;
  }
  vector<long long> d(n);
  {
    reverse((s).begin(), (s).end());
    long long cur = 1;
    for (long long i = (long long)(0); i < (long long)(n - 1); ++i) {
      if (s[i] == '>') {
        d[i] = cur;
        cur++;
      }
    }
    d[n - 1] = cur;
    reverse((s).begin(), (s).end());
    reverse((d).begin(), (d).end());
    42;
    cur = n;
    long long left = 0;
    42;
    for (long long i = (long long)(0); i < (long long)(n - 1); ++i) {
      if (s[i] == '<') {
        d[i + 1] = cur;
        cur--;
      } else {
        42;
        42;
        if (left + 1 < i + 1) reverse(d.begin() + left + 1, d.begin() + i + 1);
        42;
        left = i + 1;
      }
    }
    if (left + 1 < n) reverse(d.begin() + left + 1, d.begin() + n);
    42;
  }
  for (long long i = (long long)(0); i < (long long)(((long long)(d).size()));
       ++i)
    cout << d[i] << (i != ((long long)(d).size()) - 1 ? " " : "\n");
  for (long long i = (long long)(0); i < (long long)(((long long)(u).size()));
       ++i)
    cout << u[i] << (i != ((long long)(u).size()) - 1 ? " " : "\n");
  return 0;
}
signed main() {
  long long Q;
  cin >> Q;
  for (long long _ = (long long)(0); _ < (long long)(Q); ++_) {
    query();
  }
  return 0;
}
