#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int a[200010], b[200100];
char s[200010];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) a[i] = i, b[i] = n - i + 1;
    scanf("%s", &s);
    int len = strlen(s);
    int l = -1, r;
    for (int i = 0; i < len; i++) {
      if (s[i] == '>') {
        if (l == -1)
          l = r = i;
        else
          r = i;
      } else {
        if (l != -1) {
          for (int j = 0; j < (r - l + 2) / 2; j++)
            swap(a[l + j + 1], a[r - j + 2]);
        }
        l = -1;
      }
    }
    if (l != -1) {
      for (int j = 0; j < (r - l + 2) / 2; j++)
        swap(a[l + j + 1], a[r - j + 2]);
    }
    l = -1;
    for (int i = 0; i < len; i++) {
      if (s[i] == '<') {
        if (l == -1)
          l = r = i;
        else
          r = i;
      } else {
        if (l != -1) {
          for (int j = 0; j < (r - l + 2) / 2; j++)
            swap(b[l + j + 1], b[r - j + 2]);
        }
        l = -1;
      }
    }
    if (l != -1) {
      for (int j = 0; j < (r - l + 2) / 2; j++)
        swap(b[l + j + 1], b[r - j + 2]);
    }
    for (int i = 1; i <= n; i++) {
      cout << b[i] << ' ';
    }
    cout << endl;
    for (int i = 1; i <= n; i++) {
      cout << a[i] << ' ';
    }
    cout << endl;
  }
  return 0;
}
