#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
long long qread() {
  char c = getchar();
  int neg = 1;
  long long val = 0;
  while (c != '-' && !isdigit(c)) c = getchar();
  if (c == '-') c = getchar(), neg = -1;
  while (isdigit(c)) val = (val << 3) + (val << 1) + c - '0', c = getchar();
  return neg * val;
}
vector<int> solve(int n, string s, int x, int init, char sgn) {
  vector<int> ans;
  ans.resize(n);
  int last = 0, cur = init;
  for (int(i) = 0; (i) < (int)n; (i)++) {
    if (i == n - 1 || s[i] == sgn) {
      for (int j = i; j >= last; j--) {
        ans[j] = cur;
        cur += x;
      }
      last = i + 1;
    }
  }
  return ans;
}
int main() {
  int T = qread();
  while (T--) {
    int n = qread();
    string s;
    cin >> s;
    vector<int> ans;
    ans.resize(n);
    int last = 0, cur = n;
    for (int(i) = 0; (i) < (int)n; (i)++) {
      if (i == n - 1 || s[i] == '>') {
        for (int j = i; j >= last; j--) {
          ans[j] = cur--;
        }
        last = i + 1;
      }
    }
    for (auto i : ans) cout << i << ' ';
    cout << endl;
    ans.resize(n);
    last = 0, cur = 1;
    for (int(i) = 0; (i) < (int)n; (i)++) {
      if (i == n - 1 || s[i] == '<') {
        for (int j = i; j >= last; j--) {
          ans[j] = cur++;
        }
        last = i + 1;
      }
    }
    for (auto i : ans) cout << i << ' ';
    cout << endl;
  }
  return 0;
}
