#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t-- > 0) {
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n, 0), b(n, 0), c;
    int flag1 = 1, flag2 = 1;
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '<') {
        b[i] = flag1++;
      }
    }
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] == '<') {
        while (i > 0 && s[i - 1] == '<') {
          i--;
        }
        int x = i;
        while (s[x] == '<') {
          a[x] = flag2++;
          x++;
        }
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (b[i] == 0) {
        b[i] = flag1++;
      }
      if (a[i] == 0) {
        a[i] = flag2++;
      }
    }
    for (int i = 0; i < n; i++) {
      cout << a[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < n; i++) {
      cout << b[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
