#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t, n, i, x, j, k;
  string s;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    int a[n], b[n];
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    x = 1;
    for (i = 0; i < n - 1; i++) {
      if (s[i] == '<') a[i] = x++;
    }
    x = n;
    for (i = n - 1; i >= 0; i--) {
      k = j = i;
      if (a[i] == 0) {
        while (a[j] == 0 and j >= 0) j--;
        i = j;
        j++;
        while (j <= k) a[j] = x--, j++;
      }
    }
    x = n;
    for (i = 0; i < n - 1; i++) {
      if (s[i] == '>') b[i] = x--;
    }
    for (i = 0; i < n; i++) {
      k = j = i;
      if (b[i] == 0) {
        while (b[j] == 0 and j < n) j++;
        i = j;
        j--;
        while (j >= k) b[j] = x--, j--;
      }
    }
    for (i = 0; i < n; i++) cout << b[i] << ' ';
    cout << '\n';
    for (i = 0; i < n; i++) cout << a[i] << ' ';
    cout << '\n';
  }
}
