#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
int main() {
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    unordered_set<int> decreasing;
    for (int i = 0; i < n - 1; i++) {
      if (s.at(i) == '>') {
        decreasing.insert(i + 1);
      }
    }
    int max[n];
    int min[n];
    vector<int> positions;
    int low = 1;
    int high = n;
    for (int i = n - 1; i >= 0; i--) {
      if (decreasing.find(i) != decreasing.end()) {
        positions.push_back(i);
      } else {
        while (positions.size() != 0) {
          min[positions[0]] = low;
          positions.erase(positions.begin());
          low++;
        }
      }
    }
    while (positions.size() != 0) {
      min[positions[0]] = low;
      positions.erase(positions.begin());
      low++;
    }
    for (int i = 0; i < n; i++) {
      if (decreasing.find(i) == decreasing.end()) {
        positions.push_back(i);
      } else {
        while (positions.size() != 0) {
          min[positions[positions.size() - 1]] = high;
          high--;
          positions.pop_back();
        }
      }
    }
    while (positions.size() != 0) {
      min[positions[positions.size() - 1]] = high;
      high--;
      positions.pop_back();
    }
    low = 1;
    high = n;
    for (int i = 0; i < n; i++) {
      if (decreasing.find(i) != decreasing.end()) {
        positions.push_back(i);
      } else {
        while (positions.size() != 0) {
          max[positions[positions.size() - 1]] = low;
          positions.pop_back();
          low++;
        }
      }
    }
    while (positions.size() != 0) {
      max[positions[positions.size() - 1]] = low;
      positions.pop_back();
      low++;
    }
    for (int i = 0; i < n; i++) {
      if (decreasing.find(i) == decreasing.end()) {
        positions.push_back(i);
      } else {
        while (positions.size() != 0) {
          max[positions[0]] = low;
          low++;
          positions.erase(positions.begin());
        }
      }
    }
    while (positions.size() != 0) {
      max[positions[0]] = low;
      positions.erase(positions.begin());
      low++;
    }
    for (int i = 0; i < n; i++) {
      cout << min[i] << " ";
    }
    cout << "\n";
    for (int i = 0; i < n; i++) {
      cout << max[i] << " ";
    }
    cout << "\n";
  }
}
