#include <bits/stdc++.h>
using namespace std;
const int SZ = 5e5 + 4;
const int LG = 30;
const double EPS = 1e-7;
const int mod = 998244353;
const int inf = 2e9;
const unsigned long long hashpow = 41;
int n;
string s;
void read() {
  cin >> n >> s;
  s += '<';
}
void solve1() {
  s[n - 1] = '<';
  vector<int> ans;
  int tmp = 0;
  vector<int> b;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '>') {
      ++tmp;
    } else {
      b.push_back(tmp + 1);
      tmp = 0;
    }
  }
  int l = 1;
  for (int i = 0; i < b.size(); ++i) {
    for (int j = 0; j < b[i]; ++j) {
      ans.push_back(b[i] - j - 1 + l);
    }
    l += b[i];
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}
void solve2() {
  s[n - 1] = '>';
  vector<int> ans;
  int tmp = 0;
  vector<int> b;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '<') {
      ++tmp;
    } else {
      b.push_back(tmp + 1);
      tmp = 0;
    }
  }
  int l = 1;
  for (int i = 0; i < b.size(); ++i) {
    for (int j = 0; j < b[i]; ++j) {
      ans.push_back(n - (b[i] - j - 1 + l) + 1);
    }
    l += b[i];
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    read();
    solve2();
    solve1();
  }
  return 0;
}
