#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    string s;
    cin >> n >> s;
    long long cntM = 0, cntm = 0;
    for (char c : s) {
      cntM += (c == '>');
      cntm += (c == '<');
    }
    if (cntm == n - 1) {
      for (long long i = 0; i < 2; i++) {
        for (long long j = 0; j < n; j++) {
          cout << j + 1 << ' ';
        }
        cout << '\n';
      }
      continue;
    } else if (cntM == n - 1) {
      for (long long i = 0; i < 2; i++) {
        for (long long j = n; j >= 1; j--) {
          cout << j << ' ';
        }
        cout << '\n';
      }
      continue;
    }
    {
      vector<long long> a, b;
      for (long long i = 1; i <= n; i++) {
        if (i <= cntm) {
          a.push_back(i);
        } else {
          b.push_back(i);
        }
      }
      char last = s.front();
      vector<long long> ans1;
      vector<long long> acc;
      for (char c : s) {
        if (c != last && last == '<') {
          while (!acc.empty()) {
            ans1.push_back(acc.back());
            acc.pop_back();
          }
        }
        if (c == '>') {
          ans1.push_back(b.back());
          b.pop_back();
        } else {
          acc.push_back(a.back());
          a.pop_back();
        }
        last = c;
      }
      if (last == '<') {
        while (!acc.empty()) {
          ans1.push_back(acc.back());
          acc.pop_back();
        }
      }
      if (a.size()) {
        ans1.push_back(a.front());
      } else if (b.size()) {
        ans1.push_back(b.front());
      }
      for (long long x : ans1) {
        cout << x << ' ';
      }
      cout << '\n';
    }
    {
      vector<long long> ans(n);
      iota(ans.begin(), ans.end(), 1ll);
      char last;
      long long l = -1;
      for (long long i = 0; i < n - 1; i++) {
        if (s[i] == '<' && l != -1) {
          reverse(ans.begin() + l, ans.begin() + i + 1);
          l = -1;
        } else if (s[i] == '>' && l == -1) {
          l = i;
        }
      }
      if (l >= 1) {
        reverse(ans.begin() + l, ans.end());
      }
      for (long long x : ans) {
        cout << x << ' ';
      }
      cout << '\n';
    }
  }
}
