#include <bits/stdc++.h>
using namespace std;
const int N = 10 + 5, mod = 1e9 + 7, INF = 1e9 + 7;
const long long BIG = 1e18;
const int block = 316;
const int base = 1000000000;
const int base_digits = 9;
const int tox[] = {0, 0, 1, -1}, toy[] = {1, -1, 0, 0};
int n;
string s;
void solve() {
  cin >> n >> s;
  s = '!' + s;
  for (int i = 1; i <= n; i++) {
    int a = 0, b = 0;
    for (int j = i; j <= n; j++) {
      if (s[j] == 'a')
        a++;
      else
        b++;
      if (a == b) {
        cout << i << ' ' << j << endl;
        return;
      }
    }
  }
  cout << "-1 -1\n";
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
}
