#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int t, n, m, a[1000005] = {0}, f[1000005] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, x, y;
  cin >> t;
  string s;
  while (t--) {
    cin >> n >> s;
    for (i = 0; i < n + 5; i++) a[i] = f[i] = 0;
    if (s[0] == '<') f[0] = 1;
    for (i = 1; i < ((long long int)s.size()); i++) {
      if (s[i] == '<')
        f[i] = f[i - 1] + 1;
      else
        f[i] = 0;
    }
    a[n - 1] = 1;
    x = 1;
    for (i = ((long long int)s.size()) - 1; i >= 0; i--) {
      if (s[i] == '<') {
        a[i + 1] += f[i];
        for (j = i; j >= i - f[i] + 1; j--) a[j] = a[j + 1] - 1;
        x = max(x, a[i + 1]);
        i = i - f[i] + 1;
      } else
        a[i] = ++x;
    }
    for (i = 0; i < n; i++) cout << a[i] << " ";
    cout << '\n';
    for (i = 0; i < n + 5; i++) a[i] = f[i] = 0;
    if (s[((long long int)s.size()) - 1] == '>') f[n - 2] = 1;
    for (i = ((long long int)s.size()) - 2; i >= 0; i--) {
      if (s[i] == '>')
        f[i] = f[i + 1] + 1;
      else
        f[i] = 0;
    }
    a[0] = 1 + f[0];
    x = a[0] + 1;
    for (i = 0; i < s.size(); i++) {
      if (s[i] == '>')
        a[i + 1] = a[i] - 1;
      else {
        a[i + 1] = x + f[i + 1];
        x = a[i + 1] + 1;
      }
    }
    for (i = 0; i < n; i++) cout << a[i] << " ";
    cout << '\n';
  }
  return 0;
}
