description: You are given a string s, consisting of n letters, each letter is either 'a' or 'b'. The letters in the string are numbered from 1 to n.
  
  s[l; r] is a continuous substring of letters from index l to r of the string inclusive. 
  
  A string is called balanced if the number of letters 'a' in it is equal to the number of letters 'b'. For example, strings "baba" and "aabbab" are balanced and strings "aaab" and "b" are not.
  
  Find any non-empty balanced substring s[l; r] of string s. Print its l and r (1 ≤ l ≤ r ≤ n). If there is no such substring, then print -1 -1.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of testcases.
  
  Then the descriptions of t testcases follow.
  
  The first line of the testcase contains a single integer n (1 ≤ n ≤ 50) — the length of the string.
  
  The second line of the testcase contains a string s, consisting of n letters, each letter is either 'a' or 'b'.
  
  Output
  
  For each testcase print two integers. If there exists a non-empty balanced substring s[l; r], then print l r (1 ≤ l ≤ r ≤ n). Otherwise, print -1 -1.
  
  Example
  
  Input
  
  
  4
  1
  a
  6
  abbaba
  6
  abbaba
  9
  babbabbaa
  
  
  Output
  
  
  -1 -1
  1 6
  3 6
  2 5
  
  Note
  
  In the first testcase there are no non-empty balanced subtrings.
  
  In the second and third testcases there are multiple balanced substrings, including the entire string "abbaba" and substring "baba".
solution: import java.util.*;
  import java.io.*;
  import java.lang.*;
  import java.math.BigInteger;
  
      public class TestClass {
        public static int mod=(int)Math.pow(10,9)+7;
        static boolean[] primes = new boolean[1000001];
        static int maxn = 1000000;
        static class FastReader {
            BufferedReader br;
            StringTokenizer st;
     
            public FastReader()
            {
                br = new BufferedReader(
                    new InputStreamReader(System.in));
            }
     
            String next()
            {
                while (st == null || !st.hasMoreElements()) {
                    try {
                        st = new StringTokenizer(br.readLine());
                    }
                    catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                return st.nextToken();
            }
     
            int nextInt() { return Integer.parseInt(next()); }
     
            long nextLong() { return Long.parseLong(next()); }
     
            double nextDouble()
            {
                return Double.parseDouble(next());
            }
     
            String nextLine()
            {
                String str = "";
                try {
                    str = br.readLine();
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
                return str;
            }
        }
       
        
        public static void main(String[] args) throws Exception {
          
            //FastReader sc = new FastReader();
            Scanner sc=new Scanner(System.in);
            int t=sc.nextInt();
             while(t-->0){
          
                  int n=sc.nextInt();
                  sc.nextLine();
                  String s=sc.nextLine();
                  int a[]=new int [2];
                  int ans=-1;
                  if(n==1){
                    System.out.println(ans+" "+ans);
                    continue;
                  }
                  for(int i=0;i<n;i++){
                    if(s.charAt(i)=='a'){
                      a[0]++;
                    }
                    else{
                      a[1]++;
                    }
                    if(a[0]>0 && a[1]>0){
                      ans=i;
                      break;
                    }
                  }
                  if(ans==-1){
                    System.out.println(ans+" "+ans);
                  }else{
                    System.out.println(ans+" "+(ans+1)); 
                  }
                
             }   
              
        }
               // int x[]=new int[n];
               // int y[]=new int[n];
               // int ans=0;
               // for(int i=0;i<n;i++){
               //   x[i]=sc.nextInt();
               // }
               // for(int i=0;i<n;i++){
               //   y[i]=sc.nextInt();
               // }
        static int findMinSwaps(int arr[], int n)
        {
            // Array to store count of zeroes
            int noOfZeroes[] = new int[n];
            int i, count = 0;
     
            // Count number of zeroes
            // on right side of every one.
            noOfZeroes[n - 1] = 1 - arr[n - 1];
            for (i = n - 2; i >= 0; i--)
            {
                noOfZeroes[i] = noOfZeroes[i + 1];
                if (arr[i] == 0)
                    noOfZeroes[i]++;
            }
     
            // Count total number of swaps by adding number
            // of zeroes on right side of every one.
            for (i = 0; i < n; i++)
            {
                if (arr[i] == 1)
                    count += noOfZeroes[i];
            }
            return count;
        }
        static void sieve()
        {
            Arrays.fill(primes, true);
            primes[0] = false;
            primes[1] = false;
             
            for(int i = 2; i * i <= maxn; i++)
            {
                if (primes[i])
                {
                    for(int j = i * i;
                            j <= maxn; j += i)
                        primes[j] = false;
                }
            }
        }
        static String toBinary(int n)
        {
            String r = "";
             
            while(n != 0)
            {
                r = (n % 2 == 0 ? "0" : "1") + r;
                n /= 2;
            }
            return (r == "") ? "0" : r;
        }
       
        public static void backtrack(int n,ArrayList<Long> al,long xor,long and,int k){
          if(al.size()==n){
             //System.out.println(al+" "+xor+"   ");
             if(and>=xor){
              //System.out.println(al+"in");
              //ans =ans+1;
             }
             return;
          }
          for(long i=0;i<=(long)Math.pow(2,k)-1;i++){
             al.add(i);
             backtrack(n,al,xor^i,and&i,k);
             al.remove(al.size()-1);
          }
        }
        public static int findAlive(PriorityQueue<Integer> adj[],int n){
          int count=0;
           for(int i=1;i<=n;i++){
             if(adj[i].isEmpty())count++;
             else if(adj[i].peek()<i)count++;
           }
           return count;
        }
        public static long findMin(long n){
          if(n==0)return 0;
          if(n<=6)return 15;
          if(n<=8)return 20;
          if(n<=10)return 25;
          if(n<=12){
            return 30;
          }
          if(n<=16){
            return 40;
          }
          if(n<=20){
            return 50;
          }
          return (findMin(n%20)+(10)*25);
        }
        public static int  gcd(int a,int b){
          if(a==0){
            return b;
          }
          return gcd(b%a,a);
        }
        public static int removeZeros(int n){
              int res=0,pro=1;
              while(n>0){
              	int r=n%10;
              	if(r!=0){
              		res=res+r*pro;
              	    pro*=10;
              	}
              	n/=10;
              }
              //System.out.println(res);
              return res;
  
          }
  
      }
  