1304_D. Shortest and Longest LIS
Gildong recently learned how to find the [longest increasing subsequence](https://en.wikipedia.org/wiki/Longest_increasing_subsequence) (LIS) in O(nlog{n}) time for a sequence of length n. He wants to test himself if he can implement it correctly, but he couldn't find any online judges that would do it (even though there are actually many of them). So instead he's going to make a quiz for you about making permutations of n distinct integers between 1 and n, inclusive, to test his code with your output.

The quiz is as follows.

Gildong provides a string of length n-1, consisting of characters '<' and '>' only. The i-th (1-indexed) character is the comparison result between the i-th element and the i+1-st element of the sequence. If the i-th character of the string is '<', then the i-th element of the sequence is less than the i+1-st element. If the i-th character of the string is '>', then the i-th element of the sequence is greater than the i+1-st element.

He wants you to find two possible sequences (not necessarily distinct) consisting of n distinct integers between 1 and n, inclusive, each satisfying the comparison results, where the length of the LIS of the first sequence is minimum possible, and the length of the LIS of the second sequence is maximum possible.

Input

Each test contains one or more test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10^4).

Each test case contains exactly one line, consisting of an integer and a string consisting of characters '<' and '>' only. The integer is n (2 ≤ n ≤ 2 ⋅ 10^5), the length of the permutation you need to find. The string is the comparison results explained in the description. The length of the string is n-1.

It is guaranteed that the sum of all n in all test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case, print two lines with n integers each. The first line is the sequence with the minimum length of the LIS, and the second line is the sequence with the maximum length of the LIS. If there are multiple answers, print any one of them. Each sequence should contain all integers between 1 and n, inclusive, and should satisfy the comparison results.

It can be shown that at least one answer always exists.

Example

Input


3
3 &lt;&lt;
7 &gt;&gt;&lt;&gt;&gt;&lt;
5 &gt;&gt;&gt;&lt;


Output


1 2 3
1 2 3
5 4 3 7 2 1 6
4 3 1 7 5 2 6
4 3 2 1 5
5 4 2 1 3

Note

In the first case, 1 2 3 is the only possible answer.

In the second case, the shortest length of the LIS is 2, and the longest length of the LIS is 3. In the example of the maximum LIS sequence, 4 '3' 1 7 '5' 2 '6' can be one of the possible LIS.
```python

def main():
    
    t=int(input())
    allans=[]
    for _ in range(t):
        n,s=input().split()
        n=int(n)
        
        s=s+'$'
        seq=[] # [isIncreasing,length]
        prev=None
        l=0
        for c in s:
            if c!=prev:
                if l>0: # not first
                    seq.append([prev=='<',l])
                l=1
            else:
                l+=1
            prev=c
        seq[0][1]+=1
        
        minLIS=[] # large to small
        curr=n
        # print(seq)
        startend=[] # [start, end]
        for i in range(len(seq)):
            l=seq[i][1]
            if seq[i][0]: # is increasing
                if i==0:
                    start=n-l+1
                    end=n
                    curr=start-1
                else:
                    start=startend[i-1][0]+1
                    end=start+l-1
            else: # is decreasing
                if i+1<len(seq):
                    start=curr-seq[i+1][1]
                    end=start-l+1
                    curr=end-1
                else:
                    start=l
                    end=1
            startend.append([start,end])
        # print(seq)
        # print(startend)
        for start,end in startend:
            if start<=end:
                for v in range(start,end+1):
                    minLIS.append(v)
            else:
                for v in range(start,end-1,-1):
                    minLIS.append(v)
            # print('start:{} end:{} minLIS:{}'.format(start,end,minLIS))
        
        maxLIS=[] # small to large
        startend=[] # [start,end]
        curr=1
        for i in range(len(seq)):
            l=seq[i][1]
            if seq[i][0]: # is increasing
                if i+1<len(seq):
                    start=curr+seq[i+1][1]
                else:
                    start=curr
                end=start+l-1
                curr=end+1
            else: # is decreasing
                if i-1>=0:
                    start=startend[i-1][0]-1
                else:
                    start=l
                    curr=start+1
                end=start-l+1
            startend.append([start,end])
        # print(seq)
        # print(startend)
        for start,end in startend:
            if start<=end:
                for v in range(start,end+1):
                    maxLIS.append(v)
            else:
                for v in range(start,end-1,-1):
                    maxLIS.append(v)
        allans.append(minLIS)
        allans.append(maxLIS)
        
    
    multiLineArrayOfArraysPrint(allans)
    
    return
    
# import sys
# input=sys.stdin.buffer.readline #FOR READING PURE INTEGER INPUTS (space separation ok)
import sys
input=lambda: sys.stdin.readline().rstrip("\r\n") #FOR READING STRING/TEXT INPUTS.
 
def oneLineArrayPrint(arr):
    print(' '.join([str(x) for x in arr]))
def multiLineArrayPrint(arr):
    print('\n'.join([str(x) for x in arr]))
def multiLineArrayOfArraysPrint(arr):
    print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))
 
def readIntArr():
    return [int(x) for x in input().split()]
# def readFloatArr():
#     return [float(x) for x in input().split()]
 
def makeArr(*args):
    """
    *args : (default value, dimension 1, dimension 2,...)
    
    Returns : arr[dim1][dim2]... filled with default value
    """
    assert len(args) >= 2, "makeArr args should be (default value, dimension 1, dimension 2,..."
    if len(args) == 2:
        return [args[0] for _ in range(args[1])]
    else:
        return [makeArr(args[0],*args[2:]) for _ in range(args[1])]
 
def queryInteractive(x,y):
    print('? {} {}'.format(x,y))
    sys.stdout.flush()
    return int(input())
 
def answerInteractive(ans):
    print('! {}'.format(ans))
    sys.stdout.flush()
 
inf=float('inf')
MOD=10**9+7
 
for _abc in range(1):
    main()
```