import sys
sys.setrecursionlimit(10 ** 6)
# pow(3,2,5)==4
def isg(s):
    f1=0
    count1=0
    f2=0
    count2=0
    for i in s:
        if i=="<":
            f1=1
            count1+=1
        if i==">":
            f2=1
            count2+=1
    # print f1,f2,"um"
    return f1^f2,count1,count2
    # if f1 and f2:return 0
    # if (not f1) and (not f2):return 0
    # return 1
inp=input()
for i in range(inp):

    i2=input()
    inp2=raw_input()
    flag=1
    yed=inp2
    c1=0
    c2=0
    sw=0
    ff1=1
    ff2=1
    for i in inp2:
        if i==">":
            ff2=0
    for i in inp2:
        if i=="<":
            ff1=0
    if ff1 or ff2:
        print 0
    else:
        for x,i in enumerate(inp2):
                if i=="<":
                    c1=x
        for x,i in enumerate(inp2[::-1]):
                if i==">":
                    c2=i2-x-1
        print c1,c2
        if c1<c2:
            print 1
        else:print 0

    # print min(c1,c2)
"""

<< < ><< > >>>

"""
