#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double PI = acos(-1);
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const long double eps = 1e-9;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
const long long maxx = 2e5 + 100;
char s[maxx];
long long ans[maxx];
long long n;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n >> (s + 1);
    for (long long i = 1; i <= n; i++) ans[i] = n - i + 1;
    for (long long i = 1; i <= n - 1;) {
      long long j = i;
      while (s[j] == '<') j++;
      reverse(ans + i, ans + j + 1);
      i = j + 1;
    }
    for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
    for (long long i = 1; i <= n; i++) ans[i] = i;
    for (long long i = 1; i <= n - 1;) {
      long long j = i;
      while (s[j] == '>') j++;
      reverse(ans + i, ans + j + 1);
      i = j + 1;
    }
    for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
  }
}
