#include <bits/stdc++.h>
using namespace std;
long long int modInverse(long long int a, long long int m) {
  long long int m0 = m;
  long long int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool sortinrev(const pair<int, int>& a, const pair<int, int>& b) {
  if (a.first == b.first) return b.second > a.second;
  return a.first > b.first;
}
void run(vector<int> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
void solve() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> v(n - 1, 0), w(n - 1, 0), minlen(n), maxlen(n);
  v[n - 2] = s[n - 2] == '<';
  priority_queue<int> q, p;
  unordered_map<int, int> mp, mp2;
  for (int i = (n - 3); i >= (0); i--) {
    if (s[i] == '<') {
      v[i] = v[i + 1] + 1;
    } else {
      v[i] = 0;
    }
    if (i != 0) q.push(i);
  }
  q.push(n - 2);
  q.push(n - 1);
  q.push(n);
  for (int i = (0); i < (n - 1); i++) {
    if (mp.find(q.top()) != mp.end()) {
      q.pop();
      i--;
    } else {
      if (s[i] == '>') {
        minlen[i] = q.top();
        mp[q.top()]++;
        q.pop();
      } else {
        minlen[i] = q.top() - v[i];
        mp[q.top() - v[i]] = 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (mp.find(i) == mp.end()) {
      minlen[n - 1] = i;
      break;
    }
  }
  w[0] = s[0] == '>';
  for (int i = (1); i < (n - 1); i++) {
    if (s[i] == '>') {
      w[i] = w[i - 1] + 1;
    } else {
      w[i] = 0;
    }
    p.push(i);
  }
  p.push(n - 1);
  p.push(n);
  for (int i = (n - 2); i >= (0); i--) {
    if (mp2.find(p.top()) != mp2.end()) {
      p.pop();
      i++;
    } else {
      if (s[i] == '<') {
        maxlen[i + 1] = p.top();
        mp2[p.top()]++;
        p.pop();
      } else {
        maxlen[i + 1] = p.top() - w[i];
        mp2[p.top() - w[i]] = 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (mp2.find(i) == mp2.end()) {
      maxlen[0] = i;
      break;
    }
  }
  run(minlen);
  run(maxlen);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
