#include <bits/stdc++.h>
using namespace std;
const int w = 2e5 + 5;
const long long mod = 1e9 + 7;
char a[w];
char b[w];
int c[w], d[w];
int main() {
  int i, j;
  int t;
  cin >> t;
  while (t--) {
    int n;
    scanf("%d", &n);
    scanf("%s", a + 1);
    for (i = 1; i < n; i++)
      if (a[i] == '>')
        b[i] = '0';
      else
        b[i] = '1';
    b[0] = '1';
    int k = 1;
    for (i = n - 1; i >= 0; i--)
      if (b[i] == '0') c[i] = k, d[i] = k, k++;
    j = k;
    for (i = 0; i < n; i++)
      if (b[i] == '1') d[i] = j, j++;
    int u = n;
    int ans = 0;
    for (i = 0; i < n; i++) {
      if (b[i] == '1') ans++;
      if (b[i] == '0') {
        int yy = i - 1;
        while (ans) {
          c[yy] = u, u--;
          yy--;
          ans--;
        }
      }
    }
    int yy = i - 1;
    while (ans) {
      c[yy] = u, u--;
      yy--;
      ans--;
    }
    for (i = 0; i < n; i++) printf("%d%c", c[i], i == n - 1 ? '\n' : ' ');
    for (i = 0; i < n; i++) printf("%d%c", d[i], i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
