#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
const int MAXN = 2e5 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
void solve() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int l = 1;
    int r = n;
    vi ans1(n);
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] == '>') {
        ans1[i + 1] = l;
        l++;
      } else {
        ans1[i + 1] = r;
        r--;
      }
    }
    ans1[0] = l;
    vi ans2(n);
    l = 1;
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] == '>') {
        ans2[i + 1] = l;
        l++;
      } else {
        int j = i;
        while (j >= 0 && s[j] == '<') {
          j--;
        }
        j++;
        int k = j;
        for (ll g = j; g <= i + 1; g++) {
          ans2[g] = l;
          l++;
        }
        i = k - 1;
      }
    }
    if (ans2[0] == 0) {
      ans2[0] = l;
    }
    for (int i = 0; i < n; i++) {
      cout << ans2[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < n; i++) {
      cout << ans1[i] << " ";
    }
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
