#include <bits/stdc++.h>
using namespace std;
const int N = 200110;
int n, a[N], b[N];
int T = 1;
set<int> st;
vector<int> v;
bool vis[N];
int main() {
  cin >> T;
  while (T--) {
    cin >> n;
    string s;
    cin >> s;
    for (int i = 1; i <= n; i++) st.insert(i);
    if (s[0] == '>') {
      a[0] = *st.rbegin();
      st.erase(*st.rbegin());
    }
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '>' && (i + 1 >= s.size() || s[i + 1] == '>')) {
        a[i + 1] = *st.rbegin();
        st.erase(*st.rbegin());
      } else {
        if (!i && s[0] == '<') v.push_back(*st.rbegin()), st.erase(v.back());
        int q = i;
        v.push_back(*st.rbegin());
        st.erase(v.back());
        while (i + 1 < s.size() && s[i + 1] == '<')
          i++, v.push_back(*st.rbegin()), st.erase(v.back());
        int k = v.size() - 1;
        for (int j = q - (q == 0 && s[0] == '<'); j <= i; j++)
          a[j + 1] = v[k--];
        v.clear();
      }
    }
    for (int i = 0; i < n; i++) cout << a[i] << " ";
    cout << '\n';
    st.clear();
    for (int i = 1; i <= n; i++) st.insert(i);
    if (s[0] == '<') {
      a[0] = *st.begin();
      st.erase(*st.begin());
    }
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '<' && (i + 1 >= s.size() || s[i + 1] == '<')) {
        a[i + 1] = *st.begin();
        st.erase(*st.begin());
      } else {
        if (!i && s[0] == '>') v.push_back(*st.begin()), st.erase(v.back());
        int q = i;
        v.push_back(*st.begin());
        st.erase(v.back());
        while (i + 1 < s.size() && s[i + 1] == '>')
          i++, v.push_back(*st.begin()), st.erase(v.back());
        int k = v.size() - 1;
        for (int j = q - (q == 0 && s[0] == '>'); j <= i; j++)
          a[j + 1] = v[k--];
        v.clear();
      }
    }
    for (int i = 0; i < n; i++) cout << a[i] << " ";
    cout << '\n';
  }
  return 0;
}
