#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << p.first << ',' << p.second;
  return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}
namespace Util {
template <class T>
vector<pair<T, int>> runLength(vector<T> v) {
  vector<pair<T, int>> res;
  for (int i = 0; i < v.size(); i++) {
    if (res.empty() || res.back().first != v[i])
      res.push_back(make_pair(v[i], 1));
    else
      res.back().second++;
  }
  return res;
}
template <class T>
void compress(vector<T>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
}  // namespace Util
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> a, b;
  a.push_back(0);
  b.push_back(0);
  long long M = 1000000;
  long long now = 0;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] == '<') {
      now += M;
      a.push_back(now);
    } else {
      now--;
      a.push_back(now);
    }
  }
  now = 0;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] == '<') {
      now++;
      b.push_back(now);
    } else {
      now -= M;
      b.push_back(now);
    }
  }
  {
    vector<long long> zip = b;
    sort((zip).begin(), (zip).end());
    for (int i = 0; i < b.size(); i++)
      b[i] = lower_bound((zip).begin(), (zip).end(), b[i]) - zip.begin() + 1;
    cout << b << "\n";
  }
  {
    vector<long long> zip = a;
    sort((zip).begin(), (zip).end());
    for (int i = 0; i < a.size(); i++)
      a[i] = lower_bound((zip).begin(), (zip).end(), a[i]) - zip.begin() + 1;
    cout << a << "\n";
  }
  return;
}
signed main() {
  fastio();
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
