#include <bits/stdc++.h>
using namespace std;
template <typename T>
using prqueue = priority_queue<T>;
template <typename T>
using prqueues = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
const long long MOD = 1e9 + 7;
const unsigned long long INF = 1000000000000000000;
const long long N = 1e5 + 7;
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j < n; j++) {
      long long cnta = 0, cntb = 0;
      for (long long k = i; k <= j; k++) {
        cnta += s[k] == 'a', cntb += s[k] == 'b';
      }
      if (cnta == cntb) {
        cout << i + 1 << " " << j + 1 << "\n";
        return;
      }
    }
  }
  cout << "-1 -1 \n";
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
