#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, n;
  char s[105];
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &s[i]);
    if (s[0] == '<' && s[n - 1] == '>')
      printf("1\n");
    else
      printf("1\n");
  }
  return 0;
}
