#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200000 + 5];
int n;
char input[200000 + 5];
int output[200000 + 5];
priority_queue<int> pq[2];
int in_degree[2][200000 + 5];
void get_ans(priority_queue<int>& cur_pq, int sign, int* cur_in_degree) {
  int num = 1;
  while (!cur_pq.empty()) {
    int cur = cur_pq.top() * sign;
    cur_pq.pop();
    output[cur] = num++;
    for (auto& next : adj[cur]) {
      cur_in_degree[next]--;
      if (cur_in_degree[next] == 0) cur_pq.push(next * sign);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  scanf("%d", &t);
  for (int tc = 1; tc <= t; ++tc) {
    scanf("%d %s", &n, input);
    for (int i = 0; i < n; ++i) adj[i].clear();
    for (int i = 0; input[i]; ++i) {
      if (input[i] == '<') {
        adj[i].push_back(i + 1);
        in_degree[0][i + 1]++;
        in_degree[1][i + 1]++;
      } else {
        adj[i + 1].push_back(i);
        in_degree[0][i]++;
        in_degree[1][i]++;
      }
    }
    for (int i = 0; i < n; ++i) {
      if (in_degree[0][i] == 0) {
        pq[0].push(i);
        pq[1].push(-i);
      }
    }
    get_ans(pq[0], 1, in_degree[0]);
    for (int i = 0; i < n; ++i) printf("%d ", output[i]);
    printf("\n");
    get_ans(pq[1], -1, in_degree[1]);
    for (int i = 0; i < n; ++i) printf("%d ", output[i]);
    printf("\n");
  }
  return 0;
}
