#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  long long int mx[n], mn[n];
  for (long long int i = 0; i < n; i++) {
    mx[i] = i + 1, mn[i] = n - i;
  }
  long long int j = 0;
  for (long long int i = 0; i < n - 1; i = j) {
    while (j < n && s[i] == s[j]) j++;
    if (s[i] == '<')
      reverse(mn + i, mn + j + 1);
    else
      reverse(mx + i, mx + j + 1);
  }
  for (long long int x : mn) cout << x << " ";
  cout << endl;
  for (long long int x : mx) cout << x << " ";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int T = 1;
  cin >> T;
  while (T--) {
    solve();
    cout << endl;
  }
  return 0;
}
