#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string str;
    cin >> n >> str;
    int val = n, last = 0;
    vector<int> ans1(n);
    for (int i = 0; i < n; i++)
      if (i == n - 1 || str[i] == '>') {
        for (int j = i; j >= last; j--) {
          ans1[j] = val;
          val--;
        }
        last = i + 1;
      }
    val = 1, last = 0;
    vector<int> ans2(n);
    for (int i = 0; i < n; i++)
      if (i == n - 1 || str[i] == '<') {
        for (int j = i; j >= last; j--) {
          ans2[j] = val;
          val++;
        }
        last = i + 1;
      }
    for (auto each : ans1) cout << each << " ";
    cout << "\n";
    for (auto each : ans2) cout << each << " ";
    cout << "\n";
  }
  return 0;
}
