#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (T i : v) os << i << ", ";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &v) {
  for (T i : v) os << i << " ";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const multiset<T> &v) {
  for (T i : v) os << i << " ";
  return os;
}
template <class T, class second>
ostream &operator<<(ostream &os, const pair<T, second> &v) {
  os << v.first << ' ' << v.second;
  return os;
}
template <class T, class second>
ostream &operator<<(ostream &os, const map<T, second> &v) {
  for (auto i : v) os << '(' << i.first << " => " << i.second << ')' << ' ';
  return os;
}
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void f1(string &s) {
  int n = s.length() + 1;
  vector<int> ans(n);
  int pos = 0, c = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '>') pos = i + 1;
  }
  ans[pos] = ++c;
  if (pos > 1) {
    for (int i = pos - 2; i >= 0; i--) {
      if (s[i] == '>') {
        ans[i + 1] = ++c;
        if (i == 0) ans[i] = ++c;
      }
    }
  }
  set<int> to_do;
  while (c < n) to_do.insert(++c);
  for (int i = 1; i < n; i++) {
    if (s[i - 1] == '>' || ans[i] != 0) continue;
    int c = i;
    while (c < n && s[c - 1] == '<') c++;
    c--;
    while (c >= i) {
      ans[c] = *to_do.rbegin();
      to_do.erase(--to_do.end());
      c--;
    }
  }
  for (int i = 0; i < n; i++)
    if (ans[i] == 0) {
      ans[i] = *to_do.rbegin();
      to_do.erase(--to_do.end());
    }
  for (int i : ans) cout << i << ' ';
  cout << "\n";
}
void f2(string &s) {
  int n = s.length() + 1;
  vector<int> ans(n);
  reverse(s.begin(), s.end());
  int pos = 0, c = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '<') pos = i + 1;
  }
  ans[pos] = ++c;
  if (pos > 1) {
    for (int i = pos - 2; i >= 0; i--) {
      if (s[i] == '<') {
        ans[i + 1] = ++c;
      }
    }
  }
  c = n;
  for (int i = n - 1; i >= 0; i--)
    if (ans[i] == 0) ans[i] = c--;
  reverse(ans.begin(), ans.end());
  for (int i : ans) cout << i << ' ';
  cout << "\n";
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  f1(s);
  f2(s);
}
int main() {
  fast();
  int t;
  cin >> t;
  while (t--) solve();
}
