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: #include <bits/stdc++.h>
  using namespace std;
  bool sortbyfir(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.first == b.first) return a.second < b.second;
    return a.first < b.first;
  }
  bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second == b.second) return a.first < b.first;
    return (a.second < b.second);
  }
  bool sr(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.first == b.first)
      return a.second > b.second;
    else
      return a.first < b.first;
  }
  bool compmx(int a, int b) { return (a < b); }
  long long int binaryToDecimal(string n) {
    string num = n;
    long long int dec_value = 0;
    long long int base = 1;
    for (int i = num.length() - 1; i >= 0; i--) {
      if (num[i] == '1') dec_value += base;
      base = base * 2;
    }
    return dec_value;
  }
  string decimalToBinary(long long int n) {
    string s = bitset<64>(n).to_string();
    const auto loc1 = s.find('1');
    if (loc1 != string::npos) return s.substr(loc1);
    return "0";
  }
  long long int gcd(long long int a, long long int b) {
    if (b == 0)
      return a;
    else
      return gcd(b, a % b);
  }
  long long int lcm(long long int a, long long int b) {
    return (a / gcd(a, b)) * b;
  }
  bool is_prime(long long int x) {
    if (x == 1) return false;
    if (x == 2 || x == 3) return true;
    for (long long int i = 2; i * i <= x; i++) {
      if (x % i == 0) return false;
    }
    return true;
  }
  bool isp(string str) {
    int l = 0, h = str.length() - 1;
    while (h > l)
      if (str[l++] != str[h--]) return false;
    return true;
  }
  long long int power(long long int a, long long int b) {
    long long int res = 1ll;
    while (b > 0) {
      if (b % 2ll) res = (res * a) % 1000000007;
      ;
      a = (a * a) % 1000000007;
      ;
      b /= 2ll;
    }
    return res;
  }
  long long int interact(long long int i) {
    cout << i << "\n";
    cout.flush();
    long long int ret;
    cin >> ret;
    cout.flush();
    return ret;
  }
  vector<long long int> primes;
  void getPrimes() {
    vector<bool> p(1001, true);
    for (long long int i = 2; i * i <= 1000; i++) {
      if (p[i]) {
        for (long long int j = i * i; j <= 1000; j += i) {
          p[j] = false;
        }
      }
    }
    for (long long int i = 2; i <= 1000; i++) {
      if (p[i]) {
        primes.push_back(i);
      }
    }
  }
  long long int dx[] = {-1, 0, 1, 0};
  long long int dy[] = {0, -1, 0, 1};
  int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long int t;
    cin >> t;
    while (t--) {
      long long int n;
      string s;
      cin >> n >> s;
      long long int c = 0;
      pair<long long int, long long int> ans;
      ans.first = ans.second = -2;
      for (long long int i = 0; i < n; i++) {
        if (s[i] == 'a')
          c = 1;
        else
          c = -1;
        for (long long int j = i + 1; j < n; j++) {
          if (s[j] == 'a')
            c++;
          else
            c--;
          if (c == 0) {
            ans.first = i;
            ans.second = j;
            c = 1e9;
            break;
          }
        }
        if (c == 1e9) break;
      }
      cout << ans.first + 1 << " ";
      cout << ans.second + 1 << endl;
    }
    return 0;
  }
  