#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  s = '-' + s;
  vector<vector<int> > pref(n + 1, vector<int>(2));
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'a') {
      pref[i][0] = pref[i - 1][0] + 1;
      pref[i][1] = pref[i - 1][1];
    } else {
      pref[i][1] = pref[i - 1][1] + 1;
      pref[i][0] = pref[i - 1][0];
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if ((pref[j][0] - pref[i - 1][0]) == (pref[j][1] - pref[i - 1][1])) {
        cout << i << ' ' << j << '\n';
        return;
      }
    }
  }
  cout << -1 << ' ' << -1 << '\n';
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
