#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> lng(n);
    vector<int> shrt(n);
    iota(lng.begin(), lng.end(), 1);
    iota(shrt.rbegin(), shrt.rend(), 1);
    for (int i = 0; i < n - 1; i++) {
      int j = i;
      while (j < n - 1 && s[j] == '>') j++;
      for (int k = 0; k < (j - i + 1) / 2; k++) {
        swap(lng[k + i], lng[j - k]);
      }
      i = j;
    }
    for (int i = 0; i < n - 1; i++) {
      int j = i;
      while (j < n - 1 && s[j] == '<') j++;
      for (int k = 0; k < (j - i + 1) / 2; k++) {
        swap(shrt[k + i], shrt[j - k]);
      }
      i = j;
    }
    cout << shrt.front();
    for (int i = 1; i < shrt.size(); i++) cout << ' ' << shrt[i];
    cout << endl;
    cout << lng.front();
    for (int i = 1; i < lng.size(); i++) cout << ' ' << lng[i];
    cout << endl;
  }
  return 0;
}
