#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200;
int main() {
  char s[MAXN];
  int t, n, ans[MAXN];
  for (scanf("%d", &t); t--;) {
    scanf("%d %s", &n, s + 1);
    int num = 1;
    stack<int> st;
    for (int i = n - 1; i >= 0; --i) {
      if (s[i] == '<')
        st.push(i);
      else {
        ans[i] = num++;
        while (!st.empty()) ans[st.top()] = num++, st.pop();
      }
    }
    for (int i = 0; i < n; ++i) printf("%d ", ans[i]);
    printf("\n");
    num = 1;
    st = stack<int>();
    for (int i = 1; i <= n; ++i) {
      if (s[i] == '>')
        st.push(i);
      else {
        ans[i] = num++;
        while (!st.empty()) ans[st.top()] = num++, st.pop();
      }
    }
    for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
    printf("\n");
  }
}
