#include <bits/stdc++.h>
using namespace std;
void hertz() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  hertz();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long cur = 1;
    std::vector<long long> v(n, 0), v1(n, 0);
    for (int i = 0; i < n - 1; ++i) {
      while (s[i] == '<') {
        v[i] = cur++;
        i++;
      }
    }
    v[n - 1] = cur;
    cur = n;
    for (int i = 0; i < n - 1; ++i) {
      if (v[i] == 0) v[i] = cur--;
    }
    long long ind;
    cur = n;
    for (int i = 0; i < n - 1; ++i) {
      while (s[i] == '>') {
        v1[i] = cur--;
        i++;
      }
    }
    v1[n - 1] = cur;
    std::map<long long, long long> map1;
    long long inds, cnt = 0;
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] == '<') {
        cnt = 0;
        inds = i;
        while (s[i] == '<') {
          cnt++;
          i--;
        }
        map1[inds + 1] = cnt;
      }
    }
    long long times, st;
    cnt = 0;
    for (int i = n - 2; i >= 0; i--) {
      if (map1.count(i + 1)) {
        times = map1[i + 1];
        st = map1[i + 1];
        cnt += map1[i + 1];
        while (times--) {
          v1[i] = cnt--;
          i--;
        }
        cnt += st;
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << v1[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < n; ++i) {
      cout << v[i] << " ";
    }
    cout << "\n";
  }
}
