#include <bits/stdc++.h>
using namespace std;
int t, n;
char nl[200020];
int ans1[200020], ans2[200020];
inline long long read() {
  char c = getchar();
  int tot = 1, sum = 0;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    tot = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * tot;
}
void fz1(int l, int r) {
  for (int i = l; i <= (l + r >> 1); i++) swap(ans1[i], ans1[l + r - i]);
}
void fz2(int l, int r) {
  for (int i = l; i <= (l + r >> 1); i++) swap(ans2[i], ans2[l + r - i]);
}
int main() {
  t = read();
  while (t--) {
    n = read();
    cin >> nl + 1;
    nl[n] = '&';
    for (int i = (1); i <= (n); i++) {
      ans1[i] = n - i + 1;
      ans2[i] = i;
    }
    int now = (nl[1] == '>'), id = 1;
    for (int i = (2); i <= (n); i++) {
      if (now == 1 && nl[i] != '>') {
        fz2(id, i);
        id = i;
        now = 0;
      } else if (now == 0 && nl[i] != '<') {
        fz1(id, i);
        id = i;
        now = 1;
      }
    }
    if (now == 1) fz2(id, n);
    if (now == 0) fz1(id, n);
    for (int i = (1); i <= (n); i++) printf("%d ", ans1[i]);
    printf("\n");
    for (int i = (1); i <= (n); i++) printf("%d ", ans2[i]);
    printf("\n");
  }
  return 0;
}
