#include <bits/stdc++.h>
using namespace std;
const int N = 200007;
int n, t, ans1[N], ans2[N], c1[N], c2[N];
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    vector<int> ans1, ans2;
    for (int i = n; i >= 1; i--) ans1.emplace_back(i);
    for (int i = 1; i <= n; i++) ans2.emplace_back(i);
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '<') {
        int j = i;
        while (j < n - 1 && s[i] == s[j]) j++;
        for (int z = 0; z <= (j - i) / 2; z++) swap(ans1[z + i], ans1[j - z]);
        i = j - 1;
      }
    }
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] == '>') {
        int j = i;
        while (j >= 0 && s[i] == s[j]) j--;
        for (int z = 0; z <= (i - j) / 2; z++)
          swap(ans2[z + j + 1], ans2[i - z + 1]);
        i = j + 1;
      }
    }
    for (auto i : ans1) cout << i << " ";
    cout << "\n";
    for (auto i : ans2) cout << i << " ";
    cout << "\n";
  }
}
