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.io.DataInputStream;
  	import java.io.IOException;
  	import java.io.OutputStreamWriter;
  	import java.io.PrintWriter;
  	import java.util.Arrays;
  	import java.util.Comparator;
  import java.util.HashMap;
  import java.util.Scanner;
  
  	 
  	public class Main {
  	 
  	    private static void run() throws IOException {
  			Scanner s = new Scanner(System.in);
  		    Reader sc=new Reader();
  		    int t = sc.nextInt();
  			
  		    while(t-- > 0)
  		    {
  		    	int n = sc.nextInt();
  		    	
  		    	String x = sc.next();
  		    	
  		    	int a=0;
  		    	int b= 0;
  		    	int flag = 0;
  		    	for(int i=0;i<n-1;i++)
  		    	{	
  		    		if(x.charAt(i)=='a' && x.charAt(i+1)=='b')
  		    		{	
  		    			out.println(i+1 +" "+ (i+2));
  		    			flag = 1;
  		    		break;
  		    		}
  		    		else if(x.charAt(i)=='b' && x.charAt(i+1)=='a')
  		    		{
  		    			flag = 1;
  		    			out.println(i+1 + " "+ (i+2));
  		    			break;
  		    		}
  		    	}
  		    	if(flag==0)
  		    	out.println(-1 +" "+ -1);
  		   	
  		    	
  		    }
  			
  		
              }
  	 
  	    public static void main(String[] args) throws IOException {
  	        in = new Reader();
  	        out = new PrintWriter(new OutputStreamWriter(System.out));
  	 
  	    
  	        run();
  	        	 
  	        out.flush();
  	        in.close();
  	        out.close();
  	    }
  	 
  	    private static int gcd(int a, int b) {
  	        if (a == 0 || b == 0)
  	            return 0;
  	        while (b != 0) {
  	            int tmp;
  	            tmp = a % b;
  	            a = b;
  	            b = tmp;
  	        }
  	        return a;
  	    }
  	 
  	    static final long mod = 1000000007;
  	 
  	    static long pow_mod(long a, long b) {
  	        long result = 1;
  	        while (b != 0) {
  	            if ((b & 1) != 0) result = (result * a) % mod;
  	            a = (a * a) % mod;
  	            b >>= 1;
  	        }
  	        return result;
  	    }
  	 
  	    private static long multiplied_mod(long... longs) {
  	        long ans = 1;
  	        for (long now : longs) {
  	            ans = (ans * now) % mod;
  	        }
  	        return ans;
  	    }
  	 
  	    @SuppressWarnings("FieldCanBeLocal")
  	    private static Reader in;
  	    private static PrintWriter out;
  	 
  	    private static int[] read_int_array(int len) throws IOException {
  	        int[] a = new int[len];
  	        for (int i = 0; i < len; i++) {
  	            a[i] = in.nextInt();
  	        }
  	        return a;
  	    }
  	 
  	    private static long[] read_long_array(int len) throws IOException {
  	        long[] a = new long[len];
  	        for (int i = 0; i < len; i++) {
  	            a[i] = in.nextLong();
  	        }
  	        return a;
  	    }
  	 
  	    private static void print_array(int[] array) {
  	        for (int now : array) {
  	            out.print(now);
  	            out.print(' ');
  	        }
  	        out.println();
  	    }
  	 
  	    private static void print_array(long[] array) {
  	        for (long now : array) {
  	            out.print(now);
  	            out.print(' ');
  	        }
  	        out.println();
  	    }
  	 
  	    static class Reader {
  	        private static final int BUFFER_SIZE = 1 << 16;
  	        private final DataInputStream din;
  	        private final byte[] buffer;
  	        private int bufferPointer, bytesRead;
  	 
  	        Reader() {
  	            din = new DataInputStream(System.in);
  	            buffer = new byte[BUFFER_SIZE];
  	            bufferPointer = bytesRead = 0;
  	        }
  	 
  	        public String readLine() throws IOException {
  	            final byte[] buf = new byte[1024]; // line length
  	            int cnt = 0, c;
  	            while ((c = read()) != -1) {
  	                if (c == '\n') {
  	                    break;
  	                }
  	                buf[cnt++] = (byte) c;
  	            }
  	            return new String(buf, 0, cnt);
  	        }
  	 
  	        public int nextSign() throws IOException {
  	            byte c = read();
  	            while ('+' != c && '-' != c) {
  	                c = read();
  	            }
  	            return '+' == c ? 0 : 1;
  	        }
  	 
  	        private static boolean isSpaceChar(int c) {
  	            return !(c >= 33 && c <= 126);
  	        }
  	 
  	        public int skip() throws IOException {
  	            int b;
  	            // noinspection ALL
  	            while ((b = read()) != -1 && isSpaceChar(b)) {
  	                ;
  	            }
  	            return b;
  	        }
  	 
  	        public char nc() throws IOException {
  	            return (char) skip();
  	        }
  	 
  	        public String next() throws IOException {
  	            int b = skip();
  	            final StringBuilder sb = new StringBuilder();
  	            while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')
  	                sb.appendCodePoint(b);
  	                b = read();
  	            }
  	            return sb.toString();
  	        }
  	 
  	        public int nextInt() throws IOException {
  	            int ret = 0;
  	            byte c = read();
  	            while (c <= ' ') {
  	                c = read();
  	            }
  	            final boolean neg = c == '-';
  	            if (neg) {
  	                c = read();
  	            }
  	            do {
  	                ret = ret * 10 + c - '0';
  	            } while ((c = read()) >= '0' && c <= '9');
  	 
  	            if (neg) {
  	                return -ret;
  	            }
  	            return ret;
  	        }
  	 
  	        public long nextLong() throws IOException {
  	            long ret = 0;
  	            byte c = read();
  	            while (c <= ' ') {
  	                c = read();
  	            }
  	            final boolean neg = c == '-';
  	            if (neg) {
  	                c = read();
  	            }
  	            do {
  	                ret = ret * 10 + c - '0';
  	            }
  	            while ((c = read()) >= '0' && c <= '9');
  	            if (neg) {
  	                return -ret;
  	            }
  	            return ret;
  	        }
  	 
  	        public double nextDouble() throws IOException {
  	            double ret = 0, div = 1;
  	            byte c = read();
  	            while (c <= ' ') {
  	                c = read();
  	            }
  	            final boolean neg = c == '-';
  	            if (neg) {
  	                c = read();
  	            }
  	 
  	            do {
  	                ret = ret * 10 + c - '0';
  	            }
  	            while ((c = read()) >= '0' && c <= '9');
  	 
  	            if (c == '.') {
  	                while ((c = read()) >= '0' && c <= '9') {
  	                    ret += (c - '0') / (div *= 10);
  	                }
  	            }
  	 
  	            if (neg) {
  	                return -ret;
  	            }
  	            return ret;
  	        }
  	 
  	        private void fillBuffer() throws IOException {
  	            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
  	            if (bytesRead == -1) {
  	                buffer[0] = -1;
  	            }
  	        }
  	 
  	        private byte read() throws IOException {
  	            if (bufferPointer == bytesRead) {
  	                fillBuffer();
  	            }
  	            return buffer[bufferPointer++];
  	        }
  	 
  	        public void close() throws IOException {
  	            din.close();
  	        }
  	 
  	    }
  	
  }
  