#include <bits/stdc++.h>
using namespace std;
const int N = 2e+5;
int q, n, m, t, L, R;
int mn, mx, ct;
string s;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> s;
    s += '>';
    vector<int> a(n + 1, 0), R;
    int p = n;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '>') {
        a[i] = p;
        p--;
        R.push_back(i);
      }
    }
    for (int i = 0; i < R.size(); i++) {
      for (int j = R[i] - 1; j >= 0 && s[j] != '>'; j--) {
        a[j] = p;
        p--;
      }
    }
    for (int i = 0; i < n; i++) cout << a[i] << ' ';
    cout << '\n';
    a = vector<int>(n + 1, 0);
    p = n;
    s.pop_back();
    s = "<" + s;
    R.clear();
    for (int i = s.size() - 1; i >= 0; i--) {
      if (s[i] == '<') {
        a[i] = p;
        p--;
        R.push_back(i);
      }
    }
    for (int i = R.size() - 1; i >= 0; i--) {
      for (int j = R[i] + 1; j < n && s[j] != '<'; j++) {
        a[j] = p;
        p--;
      }
    }
    for (int i = 0; i < n; i++) cout << a[i] << ' ';
    cout << '\n';
  }
}
