#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
const long long INF = 1e9 + 10;
const long long MOD = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  s = '0' + s;
  vector<long long> ans1(n + 1), ans2(n + 1);
  vector<long long> tmp;
  long long pos = -1;
  for (long long i = n - 1; i >= 1; i--) {
    if (s[i] == '<')
      pos = i;
    else {
      if (pos != -1) tmp.push_back(pos);
      pos = -1;
    }
  }
  if (pos != -1) tmp.push_back(pos);
  long long num = 1;
  for (long long i = 0; i < (long long)tmp.size(); i++) {
    long long cur = tmp[i];
    while (cur < n && s[cur] == '<') ans1[cur++] = num++;
  }
  long long num2 = 1;
  for (long long i = (long long)tmp.size() - 1; i >= 0; i--) {
    long long cur = tmp[i];
    while (cur < n && s[cur] == '<') ans2[cur++] = num2++;
  }
  for (long long i = n; i >= 1; i--) {
    if (ans1[i] == 0) ans1[i] = num++;
    if (ans2[i] == 0) ans2[i] = num2++;
  }
  for (long long i = 1; i <= n; i++) cout << ans1[i] << ' ';
  cout << '\n';
  for (long long i = 1; i <= n; i++) cout << ans2[i] << ' ';
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
