#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    vector<int> l, g;
    g.push_back(0);
    for (int i = 1; i < n; ++i) {
      char c;
      cin >> c;
      if (c == '<')
        l.push_back(i);
      else if (c == '>')
        g.push_back(i);
    }
    l.push_back(n);
    vector<int> ans(n);
    int pre = n, cnt = 1;
    reverse(g.begin(), g.end());
    for (int it : g) {
      for (int i = it; i < pre; ++i) ans[i] = cnt++;
      pre = it;
    }
    for (int it : ans) cout << it << " ";
    cout << '\n';
    pre = -1, cnt = 1;
    for (int it : l) {
      for (int i = it - 1; i > pre; --i) ans[i] = cnt++;
      pre = it - 1;
    }
    for (int it : ans) cout << it << " ";
    cout << '\n';
  }
}
