#include <bits/stdc++.h>
using namespace std;
pair<long long, int> b[1000000 + 10];
const int maxn = 2 * 1e5 + 100, maxm = 100;
char s[maxn];
bool vis[maxn];
int lena, lenb;
int split_at;
bool cmp(int &a, int &b) { return a > b; }
struct customer {
  long long t, low, high;
};
vector<int> ans1, ans2;
string doit() {
  ans1.resize(0);
  ans2.resize(0);
  int n;
  scanf("%d%s", &n, s + 1);
  s[0] = '>';
  s[n] = '>';
  int cur = n;
  for (int i = 0; i < n;) {
    if (s[i] == '<') {
      int j = i + 1;
      for (; j < n && s[j] == '<'; j++)
        ;
      for (int k = cur - j + i; k <= cur; k++) {
        ans2.push_back(k);
      }
      cur -= j - i + 1;
      i = j;
    } else {
      if (i + 1 <= n && s[i + 1] == '<') {
        i++;
        continue;
      }
      ans2.push_back(cur);
      cur--;
      i++;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", ans2[i]);
  puts("");
  s[0] = '<';
  s[n] = '<';
  cur = 1;
  for (int i = 0; i < n;) {
    if (s[i] == '>') {
      int j = i + 1;
      for (; j < n && s[j] == '>'; j++)
        ;
      for (int k = j - i + cur; k >= cur; k--) {
        ans1.push_back(k);
      }
      cur += j - i + 1;
      i = j;
    } else {
      if (i + 1 <= n && s[i + 1] == '>') {
        i++;
        continue;
      }
      ans1.push_back(cur);
      cur++;
      i++;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", ans1[i]);
  puts("");
  return "";
}
int main() {
  int n, m, t;
  deque<char> ans;
  cin >> t;
  while (t--) {
    doit();
  }
}
