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.BufferedInputStream;
  import java.io.InputStream;
  import java.io.PrintWriter;
  
  /*
  Nikunj Khokhar
  Software Engineer
  Google Warsaw
   */
  
  public class Main {
  
    public static void main(String[] args) {
      ScanReader in = new ScanReader(System.in);
      PrintWriter out = new PrintWriter(System.out);
      int t = in.scanInt();
      out:
      while (t-- > 0) {
        int n = in.scanInt();
        String s = in.scanString();
        for (int i = 0; i < n - 1; i++) {
          if (s.charAt(i) != s.charAt(i + 1)) {
            out.println((i + 1) + " " + (i + 2));
            continue out;
          }
        }
        out.println("-1 -1");
      }
      out.close();
    }
  }
  
  class ScanReader {
  
    /**
     * @author Nikunj Khokhar
     */
    private byte[] buf = new byte[4 * 1024];
    private int index;
    private BufferedInputStream in;
    private int total;
  
    public ScanReader(InputStream inputStream) {
      in = new BufferedInputStream(inputStream);
    }
  
    private int scan() {
      if (index >= total) {
        index = 0;
        try {
          total = in.read(buf);
        } catch (Exception e) {
          e.printStackTrace();
        }
        if (total <= 0) {
          return -1;
        }
      }
      return buf[index++];
    }
  
    public char scanChar() {
      int c = scan();
      while (isWhiteSpace(c)) {
        c = scan();
      }
      return (char) c;
    }
  
  
    public int scanInt() {
      int integer = 0;
      int n = scan();
      while (isWhiteSpace(n)) {
        n = scan();
      }
      int neg = 1;
      if (n == '-') {
        neg = -1;
        n = scan();
      }
      while (!isWhiteSpace(n)) {
        if (n >= '0' && n <= '9') {
          integer *= 10;
          integer += n - '0';
          n = scan();
        }
      }
      return neg * integer;
    }
  
    public String scanString() {
      int c = scan();
      if (c == -1) {
        return null;
      }
      while (isWhiteSpace(c)) {
        c = scan();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = scan();
      } while (!isWhiteSpace(c));
      return res.toString();
    }
  
    public char[] scanChars(int n) {
      char[] ar = new char[n];
      int c = scan();
      boolean flag = true;
      while (isWhiteSpace(c)) {
        c = scan();
      }
      ar[0] = (char) c;
      for (int i = 1; i < n; i++) {
        ar[i] = (char) (c = scan());
      }
      return ar;
    }
  
    public String scanLine() {
      int c = scan();
      if (c == -1) {
        return null;
      }
      while (isWhiteSpace(c)) {
        c = scan();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = scan();
      } while (c != '\n' && c != -1);
      return res.toString();
    }
  
    public String next() {
      int c = scan();
      if (c == -1) {
        return null;
      }
      while (isWhiteSpace(c)) {
        c = scan();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = scan();
      } while (c != '\n' && c != -1);
      return res.toString();
    }
  
    private boolean isWhiteSpace(int n) {
      if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) {
        return true;
      } else {
        return false;
      }
    }
  
    public long scanLong() {
      long integer = 0;
      int n = scan();
      while (isWhiteSpace(n)) {
        n = scan();
      }
      int neg = 1;
      if (n == '-') {
        neg = -1;
        n = scan();
      }
      while (!isWhiteSpace(n)) {
        if (n >= '0' && n <= '9') {
          integer *= 10;
          integer += n - '0';
          n = scan();
        }
      }
      return neg * integer;
    }
  
    public void scanLong(long[] A) {
      for (int i = 0; i < A.length; i++) {
        A[i] = scanLong();
      }
    }
  
    public void scanInt(int[] A) {
      for (int i = 0; i < A.length; i++) {
        A[i] = scanInt();
      }
    }
  
    public void scanInt(int[] A, int size) {
      for (int i = 0; i < size; i++) {
        A[i] = scanInt();
      }
    }
  
    public double scanDouble() {
      int c = scan();
      while (isWhiteSpace(c)) {
        c = scan();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = scan();
      }
      double res = 0;
      while (!isWhiteSpace(c) && c != '.') {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, scanInt());
        }
        res *= 10;
        res += c - '0';
        c = scan();
      }
      if (c == '.') {
        c = scan();
        double m = 1;
        while (!isWhiteSpace(c)) {
          if (c == 'e' || c == 'E') {
            return res * Math.pow(10, scanInt());
          }
          m /= 10;
          res += (c - '0') * m;
          c = scan();
        }
      }
      return res * sgn;
    }
  
  }
  