#include <bits/stdc++.h>
using namespace std;
int get_mn(set<int> &st) {
  int ans = *st.begin();
  st.erase(st.begin());
  return ans;
}
int get_mx(set<int> &st) {
  auto it = st.end();
  --it;
  int ans = *it;
  st.erase(ans);
  return ans;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  s.push_back('>');
  set<int> st;
  for (int i = 0; i <= n; ++i) {
    st.insert(i);
  }
  vector<int> vec(n, -1);
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '>') {
      vec[i] = get_mx(st);
      for (int j = i - 1; j >= 0 && vec[j] == -1; --j) {
        vec[j] = get_mx(st);
      }
    }
  }
  for (auto &i : vec) {
    cout << i << " ";
  }
  cout << "\n";
  vec.assign(n, -1);
  s.back() = '<';
  st.clear();
  for (int i = 1; i <= n + 1; ++i) {
    st.insert(i);
  }
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '<') {
      vec[i] = get_mn(st);
      for (int j = i - 1; j >= 0 && vec[j] == -1; --j) {
        vec[j] = get_mn(st);
      }
    }
  }
  for (auto &i : vec) {
    cout << i << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  int q;
  cin >> q;
  while (q > 0) {
    --q;
    solve();
  }
}
