#include <bits/stdc++.h>
using namespace std;
int t, n;
const int N = 2e5 + 10;
string s;
int res1[N], res2[N];
void solve() {
  cin >> n;
  cin >> s;
  int tp = n;
  for (int i = 0; i < n; i++) res1[i] = n - i;
  for (int i = 0; i < n; i++) res2[i] = i + 1;
  for (int i = 0; i < s.size();) {
    int j = i;
    while (s[j] == '<') j++;
    reverse(res1 + i, res1 + j + 1);
    i = j + 1;
  }
  for (int i = 0; i < n; i++) cout << res1[i] << " ";
  cout << endl;
  for (int i = 0; i < s.size();) {
    int j = i;
    while (s[j] == '>') j++;
    reverse(res2 + i, res2 + j + 1);
    i = j + 1;
  }
  for (int i = 0; i < n; i++) cout << res2[i] << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
