```go
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var t int
fmt.Fscan(reader, &t)
for ; t > 0; t-- {
var n int
var s string
fmt.Fscan(reader, &n, &s)
// Calculate Min LIS Sequence
// Strategy: Identify increasing runs implied by '<'.
// Assign values to these runs in reverse order (largest values to the first run, etc.)
minAns := make([]int, n)
blockLens := make([]int, 0)
currLen := 0
for i := 0; i < n-1; i++ {
currLen++
if s[i] == '>' {
blockLens = append(blockLens, currLen)
currLen = 0
}
}
blockLens = append(blockLens, currLen+1)
currNum := n
idx := 0
for _, l := range blockLens {
startVal := currNum - l + 1
for k := 0; k < l; k++ {
minAns[idx] = startVal + k
idx++
}
currNum -= l
}
for i := 0; i < n; i++ {
if i > 0 {
writer.WriteByte(' ')
}
fmt.Fprint(writer, minAns[i])
}
writer.WriteByte('\n')
// Calculate Max LIS Sequence
// Strategy: Start with sorted sequence 1..n. Reverse segments corresponding to contiguous '>' in s.
maxAns := make([]int, n)
for i := 0; i < n; i++ {
maxAns[i] = i + 1
}
for i := 0; i < n-1; {
if s[i] == '>' {
j := i
for j < n-1 && s[j] == '>' {
j++
}
// Reverse the subarray from index i to j (inclusive)
// The contiguous '>' sequence from s[i] to s[j-1] affects indices i to j in the permutation.
l, r := i, j
for l < r {
maxAns[l], maxAns[r] = maxAns[r], maxAns[l]
l++
r--
}
i = j
} else {
i++
}
}
for i := 0; i < n; i++ {
if i > 0 {
writer.WriteByte(' ')
}
fmt.Fprint(writer, maxAns[i])
}
writer.WriteByte('\n')
}
}
```