#include <bits/stdc++.h>
using namespace std;
void setFor(char ch1, char ch2, int res1[], int n, string s, int& v, int& v2) {
  for (int i = 1; i <= n - 2; i++) {
    if (res1[i] != -1 && s[i - 1] == ch1 && s[i] == ch2) {
      char sign = s[i - 1];
      int j1 = i - 1, j2 = i + 1;
      while (j1 >= 0 && j2 < n && res1[j1] == -1 && res1[j2] == -1) {
        if (sign == '>') {
          res1[j1--] = v++;
          res1[j2++] = v++;
        } else {
          res1[j2++] = v2--;
          res1[j1--] = v2--;
        }
      }
      while (j1 >= 0 && res1[j1] == -1) {
        if (sign == '>') {
          res1[j1--] = v++;
        } else {
          res1[j1--] = v2--;
        }
      }
      while (j2 < n && res1[j2] == -1) {
        if (sign == '>') {
          res1[j2++] = v++;
        } else {
          res1[j2++] = v2--;
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t, n, m;
  cin >> t;
  while (t--) {
    cin >> n;
    string s;
    cin >> s;
    int res1[n], res2[n];
    for (int i = 0; i < n; i++) {
      res2[i] = -1;
      res1[i] = i + 1;
    }
    for (int i = 0; i < n - 1;) {
      int j = i;
      if (s[j] == '<') {
        i++;
        continue;
      }
      while (j < n - 1 && s[j] == '>') {
        j++;
      }
      reverse(res1 + i, res1 + j + 1);
      i = j;
    }
    int v3 = 1, v4 = n;
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] == '>') {
        res2[i + 1] = v3++;
      }
    }
    if (s[0] == '>') res2[0] = v3++;
    for (int i = 0; i < n;) {
      if (res2[i] == -1) {
        int j = i;
        while (j < n && res2[j] == -1) j++;
        int k = j - 1;
        while (k >= i) {
          res2[k--] = v4--;
        }
        i = j;
      } else
        i++;
    }
    for (int i = 0; i < n; i++) {
      if (res1[i] == -1) {
        for (int i = 0; i < n; i++) {
          res1[i] = res2[i];
        }
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      cout << res2[i] << " ";
    }
    cout << '\n';
    for (int i = 0; i < n; i++) {
      cout << res1[i] << " ";
    }
    cout << '\n';
  }
}
