#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long powmod(long long a, long long b, long long MOD) {
  if (a == 0ll) {
    return 0ll;
  }
  a %= MOD;
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = ans * a % MOD;
    }
    a = a * a % MOD;
    b >>= 1;
  }
  return ans;
}
void Pv(const vector<int> &V) {
  int Len = int(V.size());
  for (int i = 0; i < Len; ++i) {
    printf("%d", V[i]);
    if (i != Len - 1) {
      printf(" ");
    } else {
      printf("\n");
    }
  }
}
void Pvl(const vector<long long> &V) {
  int Len = int(V.size());
  for (int i = 0; i < Len; ++i) {
    printf("%lld", V[i]);
    if (i != Len - 1) {
      printf(" ");
    } else {
      printf("\n");
    }
  }
}
inline long long readll() {
  long long tmp = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar();
  return tmp * fh;
}
inline int readint() {
  int tmp = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar();
  return tmp * fh;
}
const int maxn = 300010;
const int inf = 0x3f3f3f3f;
std::vector<int> v[maxn];
int n;
char s[maxn];
int in[maxn];
int in2[maxn];
int ans1[maxn];
int ans2[maxn];
queue<int> q;
int id;
bool vis[maxn];
void dfs(int *ans, int x) {
  vis[x] = 1;
  ans[x] = id--;
  for (auto y : v[x]) {
    if (!vis[y] && --in[y] == 0) dfs(ans, y);
  }
}
int main() {
  int t;
  t = readint();
  while (t--) {
    n = readint();
    scanf("%s", s + 1);
    for (int i = 1; i <= n - 1; i++) {
      if (s[i] == '>') {
        in[i + 1]++;
        v[i].push_back(i + 1);
      } else {
        in[i]++;
        v[i + 1].push_back(i);
      }
    }
    for (int i = 1; i <= n; i++) {
      in2[i] = in[i];
    }
    id = n;
    for (int i = 1; i <= n; i++) {
      if (!in2[i]) {
        dfs(ans1, i);
      }
    }
    for (int i = 1; i <= n; i++) {
      in[i] = in2[i];
      vis[i] = 0;
    }
    id = n;
    for (int i = n; i >= 1; --i) {
      if (!in2[i]) {
        dfs(ans2, i);
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d%c", ans1[i], i == n ? '\n' : ' ');
    }
    for (int i = 1; i <= n; i++) {
      printf("%d%c", ans2[i], i == n ? '\n' : ' ');
    }
    for (int i = 1; i <= n; i++) {
      v[i].clear();
      in[i] = 0;
      in2[i] = 0;
      vis[i] = 0;
    }
  }
  return 0;
}
