import java.util.*;

public class Solution {

    static boolean ch(char a, char b){
        return ((a=='<' && b=='>')||(a=='>' && b=='<'));
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int q = in.nextInt();

        for(; q>0; q--){
            int n = in.nextInt(), ans = 1;
            char a[] = in.next().toCharArray();
            if(a[n-1]=='<' || a[0]=='>') ans = 0;
            System.out.println(ans);
        }

    }

}