#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
clock_t timeStart, timeFinish;
void timeBegin() { timeStart = clock(); }
void timeEnd() { timeFinish = clock(); }
void timeDuration() {
  double time_taken = double(timeFinish - timeStart) / double(CLOCKS_PER_SEC);
  cout << "Time taken by program is : " << fixed << time_taken
       << setprecision(5);
  cout << " sec " << endl;
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int l = 1, r = n;
  vector<int> v, u;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '<')
      v.push_back(l++);
    else
      v.push_back(r--);
  }
  v.push_back(l++);
  l = 1, r = n;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '>')
      u.push_back(r--);
    else {
      int j = i;
      for (; j < n - 1; j++) {
        if (s[j] == '>') {
          break;
        }
      }
      j--;
      int k = j - i + 2;
      int a = r;
      r -= k - 1;
      for (int k = r; k <= a; k++) u.push_back(k);
      r--;
      i = j + 1;
    }
  }
  if (l == r) u.push_back(r);
  for (auto w : u) cout << w << " ";
  cout << "\n";
  for (auto w : v) cout << w << " ";
  cout << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
