#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int t, n;
char s[maxn];
long long a[maxn], b[maxn], c[maxn], d[maxn];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%s", &n, s + 1);
    a[1] = 2e12, b[1] = maxn;
    for (int i = 2; i <= n; ++i) {
      if (s[i - 1] == '>')
        a[i] = a[i - 1] - maxn, b[i] = b[i - 1] - 1;
      else
        a[i] = a[i - 1] + 1, b[i] = b[i - 1] + maxn;
    }
    for (int i = 1; i <= n; ++i) c[i] = a[i], d[i] = b[i];
    sort(c + 1, c + 1 + n);
    sort(d + 1, d + 1 + n);
    int l1 = unique(c + 1, c + 1 + n) - c - 1,
        l2 = unique(d + 1, d + 1 + n) - d - 1;
    for (int i = 1; i <= n; ++i) {
      a[i] = lower_bound(c + 1, c + 1 + l1, a[i]) - c;
      b[i] = lower_bound(d + 1, d + 1 + l2, b[i]) - d;
    }
    for (int i = 1; i <= n; ++i) printf("%d ", a[i]);
    puts("");
    for (int i = 1; i <= n; ++i) printf("%d ", b[i]);
    puts("");
  }
  return 0;
}
