#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long inf = 1e18, MOD = 1e9 + 7;
long long n, m, k, ar[1000005], br[1000005];
string s, s1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int ti = 1;
  cin >> ti;
  while (ti--) {
    cin >> n;
    cin >> s;
    vector<long long> ans_min(n + 2, 0), ans_max(n + 2, 0);
    long long k = 1;
    set<long long> pos1;
    pos1.insert(n + 1);
    for (long long i = n - 2; i >= 0; i--) {
      if (s[i] == '>') {
        ans_min[i + 2] = k;
        k++;
        pos1.insert(i + 2);
      }
    }
    k = n;
    long long last1 = 0;
    for (auto i : pos1) {
      for (long long j = i - 1; j >= last1 + 1; j--) {
        ans_min[j] = k;
        k--;
      }
      last1 = i;
    }
    set<long long> pos;
    pos.insert(n + 1);
    k = n;
    for (long long i = n - 2; i >= 0; i--) {
      if (s[i] == '<') {
        ans_max[i + 2] = k;
        k--;
        pos.insert(i + 2);
      }
    }
    k = 1;
    long long last = 0;
    for (auto i : pos) {
      long long t = k + i - last - 2;
      for (long long j = last + 1; j < i; j++) {
        ans_max[j] = t;
        t--;
      }
      k += (i - last - 1);
      last = i;
    }
    for (long long i = 1; i < n + 1; i++) cout << ans_min[i] << " ";
    cout << endl;
    for (long long i = 1; i < n + 1; i++) cout << ans_max[i] << " ";
    cout << endl;
  }
  return 0;
}
