#include <bits/stdc++.h>
using namespace std;
int main() {
  char c[200005];
  int num[200005];
  int T;
  cin >> T;
  int n;
  int big, small;
  int tmpb, tmps;
  while (T--) {
    cin >> n;
    big = 0;
    small = 0;
    for (int i = 0; i < n - 1; i++) {
      cin >> c[i];
      if (c[i] == '>')
        big++;
      else
        small++;
    }
    tmps = n;
    for (int i = 0; i < n; i++) num[i] = 0;
    for (int i = 0; i < n - 1; i++) {
      if (c[i] == '<') {
        if (i == n - 2) {
          num[i + 1] = tmps--;
          for (int j = i; j >= 0; j--) {
            if (c[j] == '<')
              num[j] = tmps--;
            else
              break;
          }
        } else if (c[i + 1] == '>') {
          num[i + 1] = tmps--;
          for (int j = i; j >= 0; j--) {
            if (c[j] == '<')
              num[j] = tmps--;
            else
              break;
          }
          i++;
        } else
          continue;
      } else if (c[i] == '>') {
        num[i] = tmps--;
      }
    }
    if (num[n - 1] == 0) num[n - 1] = tmps;
    for (int i = 0; i < n; i++) {
      if (i != n - 1)
        cout << num[i] << " ";
      else
        cout << num[i] << endl;
    }
    if (c[n - 2] == '<') {
      tmps = small + 1;
      tmpb = small + 2;
      num[n - 1] = tmps--;
      num[n - 2] = tmps--;
    } else {
      tmps = small;
      tmpb = small + 1;
      num[n - 1] = tmpb++;
      num[n - 2] = tmpb++;
    }
    for (int i = n - 3; i >= 0; i--) {
      if (c[i] == '<')
        num[i] = tmps--;
      else
        num[i] = tmpb++;
    }
    for (int i = 0; i < n; i++) {
      if (i != n - 1)
        cout << num[i] << " ";
      else
        cout << num[i] << endl;
    }
  }
  return 0;
}
