#include <bits/stdc++.h>
using namespace std;
int q;
int n, c[200009];
string ss;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin >> q;
  while (q--) {
    cin >> n >> ss;
    for (int i = 0; i < n; i++) c[i] = 0;
    for (int i = 1; i < n; i++) {
      if (ss[i - 1] == '<')
        c[i] = c[i - 1] + 1;
      else
        c[i] = 0;
    }
    set<int> s;
    for (int i = 0; i < n; i++) {
      s.insert(i + 1);
    }
    vector<int> v;
    for (int i = n - 1; i >= 0; i--) {
      int x = *s.lower_bound(1);
      x = *s.lower_bound(x + c[i]);
      v.push_back(x);
      s.erase(x);
    }
    for (int i = n - 1; i >= 0; i--) cout << v[i] << " ";
    cout << "\n";
    for (int i = 0; i < n; i++) c[i] = 0;
    for (int i = n - 2; i >= 0; i--) {
      if (ss[i] == '>')
        c[i] = c[i + 1] + 1;
      else
        c[i] = 0;
    }
    c[n - 1] = 0;
    for (int i = 0; i < n; i++) {
      s.insert(i + 1);
    }
    for (int i = 0; i < n; i++) {
      int x = *s.lower_bound(1);
      x = *s.lower_bound(x + c[i]);
      cout << x << " ";
      s.erase(x);
    }
    cout << "\n";
  }
}
