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 \le l \le r \le n$). If there is no such substring, then print $-1$ $-1$.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of testcases.

Then the descriptions of $t$ testcases follow.

The first line of the testcase contains a single integer $n$ ($1 \le n \le 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 \le l \le r \le n$). Otherwise, print $-1$ $-1$.


-----Examples-----

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".

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
lan = []
for _ in range(int(input())):
	n = int(input())
	s = list(input())
	flag = False
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			lan.append(f'{i + 1} {i + 2}')
			flag = True
			break
		else:
			continue
	if flag == False:
		lan.append(f'{-1} {-1}')
for i in lan:
	print(*i, sep='')


for _ in range(int(input())):
	n = int(input())
	s = input()
	f = 0
	for i in range(n):
		d = {'a': 0, 'b': 0}
		for j in range(i, n):
			d[s[j]] += 1
			if d['a'] == d['b']:
				f = 1
				print(i + 1, j + 1)
				break
		if f == 1:
			break
	if f == 0:
		print(-1, -1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	(c1, c2) = (-1, -1)
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			c1 = i + 1
			c2 = i + 2
			break
	print(c1, c2, sep=' ')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	indx = s.find('ab')
	newindx = s.find('ba')
	if indx != -1:
		print(indx + 1, indx + 2)
	elif newindx != -1:
		print(newindx + 1, newindx + 2)
	elif newindx == -1 and indx == -1:
		print(newindx, newindx)


t = int(input())
for xx in range(t):
	n = int(input())
	s = input()
	l = -2
	r = -2
	control = 0
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			l = i
			r = i + 1
			break
	print(l + 1, r + 1)


from collections import Counter

def main():
	n = int(input())
	s = input()
	(l, r) = (0, n - 1)
	counts = Counter(s)
	if counts['a'] == 0 or counts['b'] == 0:
		print(-1, -1)
		return
	while l < n and r > 0:
		if counts['a'] == counts['b']:
			print(l + 1, r + 1)
			return
		elif counts['a'] > counts['b']:
			if s[l] == 'a':
				counts['a'] -= 1
				l += 1
			elif s[r] == 'a':
				counts['a'] -= 1
				r -= 1
			else:
				counts['b'] -= 1
				l += 1
		elif counts['b'] > counts['a']:
			if s[l] == 'b':
				counts['b'] -= 1
				l += 1
			elif s[r] == 'b':
				counts['b'] -= 1
				r -= 1
			else:
				counts['a'] -= 1
				l += 1
t = int(input())
while t > 0:
	t -= 1
	main()


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s.count('a') == 0 or s.count('b') == 0:
		print('-1 -1')
	else:
		for i in range(len(s)):
			try:
				if s[i] == 'a' and s[i + 1] == 'b' or (s[i] == 'b' and s[i + 1] == 'a'):
					print(i + 1, i + 2)
					break
			except:
				pass


cases = int(input())
for k in range(cases):
	n = int(input())
	s = str(input())
	x = 'ab'
	p = s.find('ab')
	q = s.find('ba')
	if max(p, q) != -1:
		print(max(p, q) + 1, max(p, q) + 2)
	else:
		print('-1', '-1')


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	aCount = s.count('a')
	if aCount == 0 or aCount == n:
		print(-1, -1)
	else:
		same = True
		curr = s.pop()
		while same:
			same = curr == s.pop()
		sLen = len(s)
		print(sLen + 1, sLen + 2)


t = int(input())
an = []
for _ in range(t):
	c = int(input())
	s = input()
	if 'a' in s and 'b' in s:
		if s[0] == 'a':
			l = s.index('b')
			r = l - 1
		else:
			l = s.index('a')
			r = l - 1
		an.append([r + 1, l + 1])
	else:
		an.append([-1, -1])
for _ in an:
	print(_[0], _[1])


def solve():
	n = int(input())
	s = input()
	ab = 0
	for (i, c) in enumerate(s, 1):
		if c == 'a':
			if ab < 0:
				return f'{i - 1} {i}'
			ab += 1
		else:
			if ab > 0:
				return f'{i - 1} {i}'
			ab -= 1
	return '-1 -1'

def main():
	num_tests = int(input())
	for t in range(1, num_tests + 1):
		print(solve())
main()


from typing import Counter
for _ in range(int(input())):
	n = int(input())
	s = input()
	flag = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if s[i:j + 1].count('a') == s[i:j + 1].count('b'):
				print(i + 1, j + 1)
				flag = 1
				break
		if flag == 1:
			break
	if flag == 0:
		print('-1 -1')


import sys
import os.path
from collections import *
import math
import bisect
import heapq as hq
from fractions import Fraction
from random import randint
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = sys.stdin.readline

def solve():
	n = int(input())
	s = input().rstrip('\n')
	if 'a' not in s or 'b' not in s:
		print(-1, -1)
	else:
		if 'ab' in s:
			x = s.index('ab')
		else:
			x = s.index('ba')
		print(x + 1, x + 2)
t = int(input())
while t:
	t -= 1
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	str = input()
	flag = False
	for i in range(n - 1):
		if str[i] != str[i + 1]:
			print(i + 1, i + 2)
			flag = True
			break
	if flag == False:
		print(-1, -1)


import sys
input = sys.stdin.readline

def solve():
	N = int(input())
	s = input().rstrip()
	for (i, c) in enumerate(s):
		if i < N - 1 and c != s[i + 1]:
			print(i + 1, i + 2)
			return
	print(-1, -1)
T = int(input())
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = input()
	if n == 1:
		print(-1, -1)
	else:
		l = r = -1
		for i in range(1, n):
			if s[i] != s[i - 1]:
				l = i
				r = i + 1
				break
		print(l, r)


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
import bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def I():
	return int(input())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10 ** 6
	n = random.randint(1, N)
	a = [random.randint(1, n) for i in range(n)]
	return (n, a)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print(inp)
			print('naive', a1)
			print('solve', a2)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = 1 << 63
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
alp = [chr(ord('a') + i) for i in range(26)]
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = (-1, -1)
	n = I()
	s = input()
	l = s.find('ab')
	if l != -1:
		ans = (l + 1, l + 2)
	l = s.find('ba')
	if l != -1:
		ans = (l + 1, l + 2)
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	st = input()
	if n == 1:
		print(-1, -1)
	elif 'ab' in st:
		i = st.index('ab')
		print(i + 1, i + 2)
	elif 'ba' in st:
		i = st.index('ba')
		print(i + 1, i + 2)
	else:
		print(-1, -1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	(x, y) = (-1, -1)
	for i in range(n - 1):
		a_count = 0
		b_count = 0
		if s[i] == 'a':
			a_count += 1
		else:
			b_count += 1
		flag = 0
		for j in range(i + 1, n):
			if s[j] == 'a':
				a_count += 1
			else:
				b_count += 1
			if a_count == b_count:
				(x, y) = (i + 1, j + 1)
				flag = 1
				break
		if flag:
			break
	print(x, y)


x = int(input())
while x != 0:
	num = int(input())
	str = input()
	acnt = 0
	flag = 0
	bcnt = 0
	for i in range(0, num - 1):
		for j in range(i + 1, num):
			if str[i:j + 1].count('a') == str[i:j + 1].count('b'):
				print(i + 1, j + 1)
				flag = 1
				break
			acnt = 0
			bcnt = 0
		if flag == 1:
			break
	if flag == 0:
		print('-1 -1')
	x = x - 1


for _ in range(int(input())):
	n = int(input())
	s = input()
	l = list(s)
	charset = set(l)
	if len(charset) == 1:
		print(-1, -1)
	else:
		for i in range(n - 1):
			if l[i] != l[i + 1]:
				print(i + 1, i + 2)
				break


from collections import Counter, defaultdict
from sys import stdin, stdout
import io, os, sys
input = stdin.readline

def mapinput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))

def intinput():
	return int(stdin.readline())

def strinput():
	return input().strip()

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def writ(ss):
	stdout.write(str(ss) + '\n')
for test in range(int(input())):

	def solve():
		n = intinput()
		s = strinput()
		aa = [0]
		co = 0
		for i in s:
			if i == 'a':
				co += 1
			else:
				co -= 1
			aa.append(co)
		for i in range(len(aa)):
			for j in range(i + 1, len(aa)):
				if aa[i] == aa[j]:
					return [i + 1, j]
		return [-1, -1]
	print(*solve())


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = False
	for i in range(n - 1):
		if s[i:i + 2] in ['ab', 'ba']:
			ans = (i + 1, i + 2)
			break
	if not ans:
		print(-1, -1)
	else:
		print(ans[0], ans[1])


def check(x):
	d = {'a': 0, 'b': 0}
	for y in x:
		d[y] += 1
	if d['a'] == d['b']:
		return True
	return False

def main():
	n = int(input())
	s = input()
	for i in range(n):
		(a, b) = (0, 0)
		if s[i] == 'a':
			a += 1
		else:
			b += 1
		for j in range(i + 1, n):
			if s[j] == 'a':
				a += 1
			else:
				b += 1
			if a == b:
				print(i + 1, j + 1)
				return
	print(-1, -1)
t = 1
t = int(input())
for ii in range(t):
	main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input()
		seen = {}
		seen[0] = 0
		cnt = 0
		for (r, sr) in enumerate(s):
			cnt += 1 if sr == 'a' else -1
			if cnt in seen and seen[cnt] + 1 < r + 1:
				print(seen[cnt] + 1, r + 1)
				break
			if cnt not in seen:
				seen[cnt] = r + 1
		else:
			print(-1, -1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def F():
	n = int(input())
	t = input()
	a = 0
	b = 0
	for i in range(n):
		if t[i] == 'a':
			a += 1
		else:
			b += 1
		if a > 0 and b > 0:
			return (i, i + 1)
	return (-1, -1)
for i in range(int(input())):
	print(*F())


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if n == 1:
		print(-1, -1)
	elif s.count('a') == s.count('b'):
		print(1, n)
	elif s.count('a') == 0 or s.count('b') == 0:
		print(-1, -1)
	else:
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				print(i + 1, i + 2)
				break


T = int(input())
for _ in range(T):
	n = int(input())
	s = input()
	try:
		i = s.index('ab')
	except:
		try:
			i = s.index('ba')
		except:
			i = -1
	if i != -1:
		(l, r) = (i + 1, i + 3)
		print('{} {}'.format(i + 1, i + 2))
	else:
		print('-1 -1')


for i in range(int(input())):
	n = int(input())
	a = input()
	if 'ab' in a:
		print(a.index('ab') + 1, a.index('ab') + 2)
	elif 'ba' in a:
		print(a.index('ba') + 1, a.index('ba') + 2)
	else:
		print(-1, -1)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


import sys
input = sys.stdin.readline
T = int(input())
for iii in range(T):
	n = int(input())
	s = [0] + list(input())
	for i in range(1, n + 1):
		if s[i] == 'a':
			s[i] = 1
		else:
			s[i] = -1
	wa = [0] * (n + 1)
	for i in range(1, n + 1):
		wa[i] = wa[i - 1] + s[i]
	ans = [-1, -1]
	for l in range(1, n + 1):
		for r in range(l + 1, n + 1):
			if wa[r] - wa[l - 1] == 0:
				ans = [l, r]
	print(*ans)


import aifc
import os, sys
import math
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	x = int(input())
	y = input()
	k = 0
	for i in range(len(y) - 1):
		if y[i] == 'a' and y[i + 1] == 'b':
			print(i + 1, i + 2)
			break
		elif y[i] == 'b' and y[i + 1] == 'a':
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


for _ in range(0, int(input())):
	input()
	s = input()
	x = s.find('ab')
	x = s.find('ba') if x == -1 else x
	(a, b) = [x + 1, x + 2] if x > -1 else [-1, -1]
	print(a, b)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = input().rstrip()
	try:
		idx = a.index('ab')
	except:
		try:
			idx = a.index('ba')
		except:
			idx = -1
	if idx == -1:
		print(-1, -1)
	else:
		print(idx + 1, idx + 2)


tst = int(input())
for test in range(tst):
	k = int(input())
	n = input()
	a = b = -1
	if k == 1:
		print(-1, -1)
	else:
		for i in range(k - 1):
			if n[i] != n[i + 1]:
				a = i + 1
				b = i + 2
				break
		print(a, b)


for _ in range(int(input())):
	n = int(input())
	s = input()
	f = 1
	if n == 1:
		print(-1, -1)
	else:
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				print(i + 1, i + 2)
				f = 0
				break
		if f == 1:
			print(-1, -1)


import sys
import os
from math import ceil, floor, sqrt, gcd, factorial, log, log2
from io import BytesIO, IOBase
from collections import Counter
from itertools import permutations, combinations
from bisect import bisect
from functools import reduce
inf = int(10000000000.0)
BUFSIZE = 8192
inp = lambda : int(input())
mp = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))

def main():
	for _ in range(inp()):
		n = inp()
		s = input()
		if 'b' not in s or 'a' not in s:
			print(-1, -1)
		else:
			start = 0
			a = 0
			b = 0
			for i in range(1, n):
				if s[i] == s[i - 1]:
					continue
				else:
					print(i, i + 1)
					break

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if len(s) == 1:
		print(-1, -1)
	else:
		d = False
		for i in range(len(s) - 1):
			if s[i] != s[i + 1]:
				d = True
				break
		if d == True:
			print(i + 1, i + 2)
		else:
			print(-1, -1)


def sub(s, n):
	for i in range(n - 1):
		if s[i] == 'a' and s[i + 1] == 'b':
			print(i + 1, i + 2)
			return
		if s[i] == 'b' and s[i + 1] == 'a':
			print(i + 1, i + 2)
			return
	print(-1, -1)
for t in range(int(input())):
	n = int(input())
	s = input()
	sub(s, n)


def st(s):
	flag = 0
	for i in range(0, len(s) - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			flag = 1
			break
	if flag == 0:
		print(-1, -1)
t = int(input())
for i in range(0, t):
	n = input()
	s = input()
	st(s)


def solve(s):
	n = len(s)
	for k in range(n):
		x = k
		a = 0
		b = 0
		while x >= 0:
			if s[x] == 'a':
				a += 1
			if s[x] == 'b':
				b += 1
			if a == b:
				return [x + 1, k + 1]
			x -= 1
	return [-1, -1]
for _ in range(int(input())):
	n = int(input())
	print(*solve(input()))


for i in range(int(input())):
	n = int(input())
	s = ' ' + input()
	f = True
	for i in range(1, n + 1):
		if f:
			for j in range(i + 1, n + 1):
				if s[i:j + 1].count('a') == s[i:j + 1].count('b'):
					print(i, j)
					f = False
					break
		else:
			break
	if f:
		print(-1, -1)


def inp():
	return int(input())

def is_balanced(in_str):
	if len(in_str) < 2:
		return (-1, -1)
	a_count = sum([1 for x in in_str if 'a' == x])
	b_count = sum([1 for x in in_str if 'b' == x])
	pt_1 = 0
	pt_2 = len(in_str) - 1
	if a_count == b_count:
		return (pt_1 + 1, pt_2 + 1)
	elif a_count == 0 or b_count == 0:
		return (-1, -1)
	else:
		for i in range(len(in_str) - 1):
			if in_str[i] != in_str[i + 1]:
				return (i + 1, i + 2)
		return (-1, -1)
n_tests = inp()
for test in range(n_tests):
	str_len = inp()
	line = input().strip()
	out = is_balanced(line)
	print(out[0], out[1])


import sys
import math
import heapq
from collections import defaultdict as dd
from collections import OrderedDict as od
from collections import deque
from itertools import permutations as pp
from itertools import combinations as cc
from sys import stdin
from functools import cmp_to_key as ctk
from functools import lru_cache
from bisect import bisect_left as bs_l
from bisect import bisect_right as bs_r
input = sys.stdin.readline
mod = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 5)

def comparator(x, y):
	if x[0] == y[0]:
		return y[1] - x[1]
	return True
T = int(input())
for _ in range(T):
	n = int(input())
	s = input().strip()
	f = 1
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			f = 0
			break
	if f:
		print(-1, -1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = 0
	b = 0
	for i in s:
		if i == 'a':
			a += 1
		else:
			b += 1
	if a == 0 and b != 0 or (a != 0 and b == 0):
		print('-1 -1')
	else:
		a = 0
		b = 0
		c = '#'
		for i in range(n):
			if s[i] != c and c != '#':
				print(i, ' ', i + 1)
				break
			else:
				c = s[i]


t = int(input())
while t > 0:
	n = int(input())
	s = str(input())
	if n == 1:
		print(-1, -1)
	elif s.count('a') == n or s.count('b') == n:
		print(-1, -1)
	else:
		i = 0
		while i < n - 1:
			if s[i:i + 2] == 'ab' or s[i:i + 2] == 'ba':
				print(i + 1, i + 2)
				break
			else:
				i += 1
	t -= 1


for _ in range(int(input())):
	length = int(input())
	string = input()
	Y = 0
	for i in range(length - 1):
		if string[i] != string[i + 1]:
			print(i + 1, i + 2)
			Y += 1
			break
	if Y == 0:
		print(-1, -1)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a_found = False
	b_found = False
	j = 0
	while j < n:
		if s[j] == 'a':
			a_found = True
		elif s[j] == 'b':
			b_found = True
		if a_found and b_found:
			print(j, j + 1)
			break
		j += 1
	if b_found == False or a_found == False:
		print(-1, -1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	n = n - 1
	flag = False
	for i in range(0, n):
		if s[i] == 'a' and s[i + 1] == 'b' or (s[i] == 'b' and s[i + 1] == 'a'):
			print(i + 1, ' ', i + 2)
			flag = True
			break
	if flag == False:
		print(-1, ' ', -1)


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	a = []
	for i in s:
		if i == 'a':
			a.append(1)
		else:
			a.append(-1)
	ans = False
	for i in range(n - 1):
		if a[i] + a[i + 1] == 0:
			print(i + 1, i + 2)
			ans = True
			break
	if not ans:
		print(-1, -1)
	t = t - 1


tc = int(input())
for t in range(tc):
	l = int(input())
	s = input()
	ans = -1
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			ans = [i + 1, i + 2]
			break
	if ans == -1:
		print('-1 -1')
	else:
		print(ans[0], ans[1])


t = int(input())
while t:
	t = t - 1
	check = False
	n = int(input())
	s = input()
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			print(f'{i} {i + 1}')
			check = True
			break
	if not check:
		print(f'{-1} {-1}')
	else:
		check = False


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = []
	for i in range(n):
		for j in range(i + 1, n):
			s1 = s[i:j + 1]
			p = s1.count('a')
			q = s1.count('b')
			if p == q:
				l.append([i + 1, j + 1])
				break
	if len(l) >= 1:
		print(*l[0])
	else:
		print(-1, -1)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	b = s[0]
	flag = False
	if len(s) > 1:
		for i in range(1, len(s)):
			if s[i] != b:
				print(i, i + 1)
				flag = True
				break
		if not flag:
			print(-1, -1)
	else:
		print(-1, -1)


while True:
	try:
		t = eval(input())
		for i in range(t):
			n = eval(input())
			s = input()
			f = True
			for j in range(n - 1):
				if s[j] == 'a' and s[j + 1] == 'b' or (s[j] == 'b' and s[j + 1] == 'a'):
					print(j + 1, j + 2)
					f = False
					break
			if f:
				print(-1, -1)
	except:
		break


t = int(input())
for tc in range(t):
	n = int(input())
	s = input()
	char = s[0]
	for i in range(1, n):
		if s[i] != char:
			print(i, i + 1)
			break
	else:
		print(-1, -1)


from sys import stdin, stdout
import sys
import math
import itertools
from collections import defaultdict
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(stdin.readline().strip())
	for j in range(1, t + 1):
		n = int(stdin.readline().strip())
		s = stdin.readline().strip()
		flag = 1
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				print(i + 1, i + 2)
				flag = 0
				break
		if flag:
			print(-1, -1)
main()


t = int(input())

def find_two_idx(s):
	if len(s) == 1:
		return (-1, -1)
	else:
		for idx in range(len(s) - 1):
			if s[idx + 1] != s[idx]:
				return (idx + 1, idx + 2)
		return (-1, -1)
for i in range(t):
	n = int(input())
	s = input()
	print(*find_two_idx(s))


T = int(input())
for t in range(T):
	N = int(input())
	S = input()
	for i in range(1, N):
		if S[i] != S[0]:
			print(i, i + 1)
			break
	else:
		print(-1, -1)


t = int(input())
for _ in range(t):
	flag = False
	n = int(input())
	string = input()
	ab = set()
	if len(string) < 2:
		flag = False
	for i in range(len(string)):
		if string[i] not in ab:
			ab.add(string[i])
		if len(ab) == 2:
			print(i, i + 1)
			flag = True
			break
	if flag is False:
		print(-1, -1)


for _ in range(int(input())):
	_ = int(input())
	s = input()
	a = [0]
	b = [0]
	c = 0
	for i in s:
		if i == 'a':
			a.append(a[-1] + 1)
			b.append(b[-1])
		else:
			a.append(a[-1])
			b.append(b[-1] + 1)
	for i in range(1, len(a) - 1):
		for j in range(i + 1, len(a)):
			af = a[j] - a[i - 1]
			bs = b[j] - b[i - 1]
			if af == bs:
				c = 1
				print(i, j)
				break
		if c == 1:
			break
	if c == 0:
		print(-1, -1)


import array
import bisect
import decimal
import fractions
import heapq
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def ints_get():
	return map(int, input().strip().split())

def list_get():
	return list(map(int, sys.stdin.readline().strip().split()))

def chars_get():
	return list(map(str, sys.stdin.readline().strip().split()))

def output(to_be_printed, end='\n'):
	sys.stdout.write(str(to_be_printed) + end)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = [x for x in input()]
		a = [0]
		b = [0]
		v1 = 0
		v2 = 0
		for i in range(n):
			if s[i] == 'a':
				v1 += 1
			else:
				v2 += 1
			a.append(v1)
			b.append(v2)
		flag = 0
		for i in range(1, n):
			if flag == 1:
				break
			for j in range(i + 1, n + 1):
				if a[j] - a[i - 1] == b[j] - b[i - 1]:
					print(i, j)
					flag = 1
					break
		if flag == 0:
			print(-1, -1)
	return
main()


t = int(input())

def findandprint(s):
	for i in range(1, len(s)):
		if s[i] == 'a' and s[i - 1] == 'b':
			print(i, i + 1)
			return
		elif s[i] == 'b' and s[i - 1] == 'a':
			print(i, i + 1)
			return
while t:
	t -= 1
	n = int(input())
	s = input()
	if 'ab' in s or 'ba' in s:
		findandprint(s)
	else:
		print(-1, -1)


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline().rstrip())
	data = sys.stdin.readline().rstrip()
	(l, r) = (-1, -1)
	for i in range(len(data) - 1):
		if data[i] != data[i + 1]:
			(l, r) = (i + 1, i + 1 + 1)
			break
	print(f'{l} {r}' if l != -1 and r != -1 else f'-1 -1')


for _ in range(int(input())):
	n = int(input())
	s = input()
	z = 0
	for i in range(n - 1):
		if s[i] == 'a' and s[i + 1] == 'b' or (s[i] == 'b' and s[i + 1] == 'a'):
			z = -1
			x = i + 1
			y = i + 2
			break
	if z == 0:
		print(-1, -1)
	else:
		print(x, y)


n = int(input())
for i in range(1, n + 1):
	m = int(input())
	a = input()
	if len(a) == 1:
		print('-1 -1')
	elif a.count('a') == 0 or a.count('b') == 0:
		print('-1 -1')
	elif a.count('ba') == 0 and a.count('ab') != 0:
		print(str(a.find('ab') + 1) + ' ' + str(a.find('ab') + 2))
	elif a.count('ab') == 0 and a.count('ba') != 0:
		print(str(a.find('ba') + 1) + ' ' + str(a.find('ba') + 2))
	else:
		print(str(a.find('ab') + 1) + ' ' + str(a.find('ab') + 2))


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	x = [0]
	ans1 = -1
	ans2 = -1
	for xx in s:
		if xx == 'a':
			x.append(x[-1] + 1)
		else:
			x.append(x[-1] - 1)
	for xx in range(len(x)):
		for z in range(xx + 1, len(x)):
			if x[xx] == x[z]:
				ans1 = xx + 1
				ans2 = z
	print(ans1, ans2)


t = int(input())
for i10 in range(t):
	n = int(input())
	s = input()
	if not ('b' in s and 'a' in s):
		print('-1 -1')
	else:
		for i in range(len(s)):
			if s[i] != s[i + 1]:
				print(i + 1, i + 2)
				break


for _ in range(int(input())):
	n = int(input())
	s = input()
	l = 0
	r = n - 1
	count_a = s.count('a')
	count_b = s.count('b')
	flag = False
	while r > l:
		if count_a == count_b:
			print(l + 1, r + 1)
			flag = True
			break
		elif count_a > count_b:
			if s[l] == 'a':
				l += 1
				count_a -= 1
			elif s[r] == 'a':
				r -= 1
				count_a -= 1
			else:
				l += 1
				count_b -= 1
		elif count_b > count_a:
			if s[l] == 'b':
				l += 1
				count_b -= 1
			elif s[r] == 'b':
				r -= 1
				count_b -= 1
			else:
				l += 1
				count_a -= 1
	if not flag:
		print(-1, -1)


t = int(input())
for time in range(t):
	length = int(input())
	st = input()
	flag = False
	l = 0
	r = 0
	for i in range(1, len(st)):
		temp1 = st[i - 1]
		temp2 = st[i]
		if temp1 != temp2:
			flag = True
			l = i
			r = i + 1
			break
	if flag == True:
		print(l, r)
		flag = False
	else:
		print('-1 -1')


t = int(input())
z = []
for i in range(t):
	n = int(input())
	b = input()
	p = 0
	for j in range(len(b)):
		for k in range(1, len(b) + 1):
			if b[j:k].count('a') == b[j:k].count('b') and j < k:
				r = []
				r.append(j + 1)
				r.append(k)
				q = j
				w = k
				z.append(r)
			else:
				p = p + 1
	if p == len(b) ** 2:
		z.append([-1, -1])
	z = z[0:i + 1]
for y in z:
	print(*y)


for _ in range(int(input())):
	n = int(input())
	p = input()
	ans = 0
	flag = 0
	for i in range(len(p) - 1):
		if p[i] != p[i + 1]:
			flag = 1
			ans = i + 1
			break
	if flag == 1:
		print(ans, ans + 1)
	else:
		print(-1, -1)


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	flag = False
	for j in range(n):
		p = 0
		q = 0
		for k in range(j, n):
			if a[k] == 'a':
				p += 1
			else:
				q += 1
			if p == q:
				flag = True
				break
		if flag == True:
			break
	if flag == True:
		print(j + 1, k + 1)
	else:
		print(-1, -1)


from sys import stdin, stdout
nmbr = lambda : int(input())
lst = lambda : list(map(int, input().split()))
for _ in range(nmbr()):
	n = nmbr()
	s = input()
	l = r = -2
	for i in range(n - 1):
		sub = s[i:i + 2]
		if sub in ['ab', 'ba']:
			l = i
			r = i + 1
			break
	print(l + 1, r + 1)


def f(n, s):
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			return i
	return -1
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	res = f(n, s)
	if res == -1:
		print('-1 -1')
	else:
		print(res + 1, res + 2)


for s in [*open(0)][2::2]:
	print((i := s.find('ab'[s[0] < 'b'])), i + (i > 0))


for _ in range(int(input())):
	n = int(input())
	s = input()
	if 'ab' in s:
		l = s.find('ab')
		print(l + 1, l + 2)
	elif 'ba' in s:
		l = s.find('ba')
		print(l + 1, l + 2)
	else:
		print(-1, -1)


def answer():
	n = int(input())
	s = input()
	sb = [0] * (n + 1)
	sa = [0] * (n + 1)
	tSa = 0
	tSb = 0
	for i in range(n):
		if s[i] == 'a':
			tSa += 1
		elif s[i] == 'b':
			tSb += 1
		sa[i + 1] = tSa
		sb[i + 1] = tSb
	for i in range(n):
		for j in range(i + 1, n + 1):
			if sa[j] - sa[i] == sb[j] - sb[i]:
				print(i + 1, j)
				return
	print(-1, -1)
	return
t = int(input())
for _ in range(t):
	answer()


t = int(input())
while t:
	n = int(input())
	s = input()
	flag = 0
	if len(s) == 1:
		print(-1, -1)
	else:
		for i in range(1, len(s)):
			if s[i] == 'a' and s[i - 1] == 'b' or (s[i] == 'b' and s[i - 1] == 'a'):
				flag = 1
				print(i, i + 1)
				break
		if flag == 0:
			print(-1, -1)
	t -= 1


def solve():
	n = int(input())
	s = input()
	for i in range(n):
		(a, b) = (0, 0)
		for j in range(n - i):
			if s[i + j] == 'a':
				a += 1
			else:
				b += 1
			if b == a:
				print(i + 1, i + j + 1)
				return
	print(-1, -1)
for _ in range(int(input())):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from itertools import permutations
from collections import *
from collections import deque
from operator import itemgetter, attrgetter
from decimal import *
import bisect
import math
import heapq as hq
MOD = 10 ** 9 + 7

def is_prime(n):
	if n == 2 or n == 3:
		return True
	if n < 2 or n % 2 == 0:
		return False
	if n < 9:
		return True
	if n % 3 == 0:
		return False
	r = int(n ** 0.5)
	f = 5
	while f <= r:
		if n % f == 0:
			return False
		if n % (f + 2) == 0:
			return False
		f += 6
	return True

def pow(a, b, m):
	ans = 1
	while b:
		if b & 1:
			ans = ans * a % m
		b //= 2
		a = a * a % m
	return ans

def ispalindrome(s):
	if s[:] == s[::-1]:
		return 1
	return 0
dp = []
limit = []
v = []

def dpdfs(u, t=-1):
	dp[0][u] = 0
	dp[1][u] = 0
	for i in v[u]:
		if i == t:
			continue
		if dp[1][i] == -1:
			dpdfs(i, u)
		dp[0][u] += max(abs(limit[0][u] - limit[1][i]) + dp[1][i], abs(limit[0][u] - limit[0][i]) + dp[0][i])
		dp[1][u] += max(abs(limit[1][u] - limit[1][i]) + dp[1][i], abs(limit[1][u] - limit[0][i]) + dp[0][i])
vis = []
f = 0
from queue import PriorityQueue

def z_algorithm(s):
	res = [0] * len(s)
	res[0] = len(s)
	(i, j) = (1, 0)
	while i < len(s):
		while i + j < len(s) and s[j] == s[i + j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < len(s) and k + res[k] < j:
			res[i + k] = res[k]
			k += 1
		(i, j) = (i + k, j - k)
	return res

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b

def gcdExtended(a, b):
	if a == 0:
		return (b, 0, 1)
	(gcd, x1, y1) = gcdExtended(b % a, a)
	x = y1 - b // a * x1
	y = x1
	return (gcd, x, y)
import re
for _ in range(int(input())):
	n = int(input())
	s = input()
	l = -1
	r = -1
	for i in range(1, n):
		if s[i] != s[i - 1]:
			l = i
			r = i + 1
			break
	print(l, r)


for _ in range(int(input())):
	n = int(input())
	s = input()
	if len(set(s)) == 1:
		print(-1, -1)
	else:
		if s[0] == 'a':
			p = s.find('b')
		else:
			p = s.find('a')
		print(p, p + 1)


import sys
tokens = ''.join(sys.stdin.readlines()).split()[::-1]

def next():
	return tokens.pop()

def nextInt():
	return int(next())

def nextFloat():
	return float(next())

def getIntArray(n):
	return [nextInt() for _ in range(n)]

def getFloatArray(n):
	return [nextFloat() for _ in range(n)]

def getStringArray(n):
	return [next() for _ in range(n)]
flush = sys.stdout.flush
testcase = True

def solve(testcase=1):
	nextInt()
	S = next()
	for i in range(1, len(S)):
		if S[i - 1] != S[i]:
			print(i, i + 1)
			return
	print(-1, -1)
if testcase is None:
	testcaseCount = 1
	while tokens:
		solve(testcaseCount)
		testcaseCount += 1
else:
	testcaseCount = nextInt() if testcase else 1
	for tc in range(testcaseCount):
		solve(tc + 1)
	assert not tokens


for _ in range(int(input())):
	n = int(input())
	s = input()
	q = 0
	if n == 1:
		print('-1 -1')
	else:
		for i in range(n - 1):
			if s[i] == 'a':
				if s[i + 1] == 'b':
					print(i + 1, i + 2, sep=' ')
					q = 1
					break
			elif s[i] == 'b':
				if s[i + 1] == 'a':
					print(i + 1, i + 2, sep=' ')
					q = 1
					break
		if q == 0:
			print('-1  -1')


for _ in range(int(input())):
	n = int(input())
	s = input()
	no = 1
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			no = 0
			break
	if no == 1:
		print(-1, -1)


import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LLI1(rows_number):
	return [LI1() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline().rstrip()
inf = 10 ** 16
md = 10 ** 9 + 7

def solve():
	n = II()
	s = SI()
	ctoi = {0: 0}
	cnt = 0
	for (i, c) in enumerate(s):
		if c == 'a':
			cnt += 1
		else:
			cnt -= 1
		if cnt in ctoi:
			print(ctoi[cnt] + 1, i + 1)
			return
		ctoi[cnt] = i + 1
	print(-1, -1)
for testcase in range(II()):
	solve()


for i in range(int(input())):
	(n, s) = (int(input()), input())
	pos1 = s.find('ab')
	pos2 = s.find('ba')
	if pos1 == -1 and pos2 == -1:
		print('-1 -1')
	elif pos1 == -1:
		print(pos2 + 1, pos2 + 2)
	else:
		print(pos1 + 1, pos1 + 2)


import re
n = int(input())
while n > 0:
	length = int(input())
	s = input()
	if re.match('a+b', s) or re.match('b+a', s):
		for i in range(len(s) - 1):
			if s[i] == 'a' and s[i + 1] == 'b' or (s[i + 1] == 'a' and s[i] == 'b'):
				l = i + 1
				break
		print(l, l + 1)
	else:
		print('-1 -1')
	n -= 1


for _ in range(int(input())):
	input()
	string = input()
	l = string.find('ab')
	if l == -1:
		l = string.find('ba')
	print(f'{l} {l}' if l == -1 else f'{l + 1} {l + 2}')


for i in range(int(input())):
	n = int(input())
	s = input()
	l = -1
	r = -1
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			l = i + 1
			r = i + 2
			break
	print(l, r)


def func(s):
	if len(s) == 1:
		return (-1, -1)
	a = [0] * len(s)
	for i in range(len(s)):
		if s[i] == 'a':
			a[i] += 1
		else:
			a[i] -= 1
	for i in range(len(a)):
		if i + 1 <= len(a) - 1:
			for j in range(i + 1, len(a)):
				if sum(a[i:j + 1]) == 0:
					return (i + 1, j + 1)
	return (-1, -1)
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print(*func(s))


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if n == 1 or s.count('a') == 0 or s.count('b') == 0:
		print(-1, -1)
	elif s[-1] != s[-2]:
		print(n - 1, n)
	else:
		flag = False
		for i in range(1, n):
			if s[i - 1] != s[i]:
				print(i, i + 1)
				flag = True
				break


t = int(input())
for nc in range(1, t + 1):
	n = int(input())
	s = input()
	if 'ab' in s or 'ba' in s:
		i = s.index('ab') if 'ab' in s else s.index('ba')
		print(f'{i + 1} {i + 2}')
	else:
		print('-1 -1')


for _ in range(int(input())):
	n = int(input())
	s = input()
	done = False
	for i in range(1, n):
		if s[i] != s[i - 1]:
			print(i, i + 1)
			done = True
			break
	if not done:
		print(-1, -1)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	for i in range(n - 1):
		if s[i] == 'a' and s[i + 1] == 'b':
			print(i + 1, i + 2)
			break
		elif s[i] == 'b' and s[i + 1] == 'a':
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


for i in range(int(input())):
	n = int(input())
	s = input()
	if 'ab' in s:
		x = s.index('ab')
		print(x + 1, x + 2)
	elif 'ba' in s:
		x = s.index('ba')
		print(x + 1, x + 2)
	else:
		print(-1, -1)


for x in range(int(input())):
	n = int(input())
	s = input()
	i = s.find('ab')
	if i == -1:
		j = s.find('ba')
		if j == -1:
			print(-1, -1)
		else:
			print(j + 1, j + 2)
	else:
		print(i + 1, i + 2)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		n = get_int()
		s = get_string()
		f = 0
		for i in range(n):
			(a, b) = (0, 0)
			for j in range(i, n):
				if s[j] == 'a':
					a += 1
				else:
					b += 1
				if a == b:
					print('{} {}'.format(i + 1, j + 1))
					f = 1
					break
			if f:
				break
		if f == 0:
			get_print('{} {}'.format(-1, -1))
solve()


t = input()
t = int(t)
while t > 0:
	n = int(input())
	s = input()
	for v in range(n - 1):
		if s[v] != s[v + 1]:
			print(v + 1, v + 2)
			break
	else:
		print(-1, -1)
	t -= 1


for __ in range(int(input())):
	n = int(input())
	a = input()
	(prefa, prefb) = ([0], [0])
	ac = bc = 0
	for i in a:
		if i == 'a':
			ac += 1
		else:
			bc += 1
		prefa.append(ac)
		prefb.append(bc)
	status = 0
	for i in range(0, n):
		for j in range(i + 1, n + 1):
			val = prefa[j] - prefa[i] - (prefb[j] - prefb[i])
			if val == 0:
				status = 1
				break
		if status:
			break
	if status:
		print(i + 1, j)
	else:
		print(-1, -1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(input())
	if l.count('a') == n or l.count('b') == n:
		print('-1 -1')
	else:
		for j in range(len(l) - 1):
			if l[j] == 'a' and l[j + 1] == 'b' or (l[j] == 'b' and l[j + 1] == 'a'):
				print(str(j + 1), str(j + 2))
				break


for _ in range(int(input())):
	N = int(input())
	n = input()
	x = 0
	for i in range(1, N):
		if n[i - 1] != n[i]:
			print(str(i) + ' ' + str(i + 1))
			x = 1
			break
	if x == 0:
		print('-1' + ' ' + '-1')


import math
import heapq
import string
from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort
import sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
H = 1000000000 + 7
for _ in range(I()):
	n = I()
	s = S()
	f = 0
	for i in range(n):
		for j in range(i + 1, n):
			s1 = s[i:j + 1]
			if s1.count('a') == s1.count('b'):
				print(i + 1, j + 1)
				f = 1
				break
		if f == 1:
			break
	if f == 0:
		print(-1, -1)


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	f = False
	for i in range(0, n - 1):
		if s[i] != s[i + 1]:
			print('{} {}'.format(i + 1, i + 2))
			f = True
			break
	if not f:
		print('-1 -1')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	l = -1
	r = -1
	f = 0
	for i in range(n):
		a = 0
		b = 0
		for j in range(i, n):
			if s[j] == 'a':
				a += 1
			if s[j] == 'b':
				b += 1
			if a == b:
				l = i + 1
				r = j + 1
				f = 1
				break
		if f:
			break
	print(l, r)


from collections import defaultdict
t = int(input())

def main():
	for _ in range(t):
		n = int(input())
		word = input()
		c = defaultdict(int)
		first = word[0]
		i = 1
		for second in word[1:]:
			if first != second:
				print(i, i + 1)
				break
			first = second
			i += 1
		if i == len(word):
			print(-1, -1)
main()


import math

def main():
	for i in range(int(input())):
		n = int(input())
		s = input()
		for j in range(n - 1):
			if s[j] != s[j + 1]:
				print(j + 1, j + 2)
				break
		else:
			print(-1, -1)
main()


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left, bisect
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
for _ in range(int(input())):
	n = int(input())
	s = input()[:-1]
	(l, r) = (-1, -1)
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			(l, r) = (i + 1, i + 2)
			break
	print(l, r)


t = int(input())
for q in range(t):
	n = int(input())
	s = input()
	if n == 1:
		print('-1 -1')
	else:
		flag = 1
		firstEle = s[0]
		for i in range(n):
			if i == 0:
				continue
			elif s[i] != firstEle:
				print('{} {}'.format(i, i + 1))
				flag = 0
				break
		if flag:
			print('-1 -1')


for _ in range(int(input())):
	l = -1
	r = -1
	leng = int(input())
	s = input()
	for i in range(len(s) - 1):
		if len(s) == 1:
			print(-1, -1)
		elif s[i] != s[i + 1]:
			l = i + 1
			r = i + 2
			break
	if l != -1 and r != -1:
		print(l, r)
	else:
		print(-1, -1)


def balance_string(str):
	if not 'b' in str or not 'a' in str:
		print(-1, -1)
	elif str.index('a') < str.index('b'):
		count_head = str.index('a') + 1
		count_tail = str.index('a') + 1
		for ele in str[count_head:]:
			if ele == 'a':
				count_head += 1
			count_tail = count_head
			if ele == 'b':
				count_tail += 1
				break
		print(count_head, count_tail)
	else:
		count_head = str.index('b') + 1
		count_tail = str.index('b') + 1
		for ele in str[count_head:]:
			if ele == 'b':
				count_head += 1
			count_tail = count_head
			if ele == 'a':
				count_tail += 1
				break
		print(count_head, count_tail)
ex = eval(input())
for i in range(ex):
	n = eval(input())
	str = input()[:n]
	balance_string(str)


import sys
input = sys.stdin.readline
a = int(input())
b = 0
while b < a:
	d = int(input())
	c = input()
	e = 1
	f = 0
	while e < d:
		if c[e] == 'a' and c[e - 1] == 'b':
			print(e, e + 1)
			f = f + 1
			break
		if c[e] == 'b' and c[e - 1] == 'a':
			print(e, e + 1)
			f = f + 1
			break
		if e == d - 1:
			print(-1, -1)
			f = f + 1
			break
		e = e + 1
	if f == 0:
		print(-1, -1)
	b = b + 1


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	ans1 = 0
	ans2 = 0
	for j in range(n - 1):
		if s[j] == 'a' and s[j + 1] == 'b' or (s[j] == 'b' and s[j + 1] == 'a'):
			ans1 = j
			ans2 = j + 1
			break
	if ans1 == 0 and ans2 == 0:
		print(-1, -1)
	else:
		print(ans1 + 1, ans2 + 1)


from collections import Counter

def solve():
	n = int(input())
	s = input()
	for (i, char) in enumerate(s[:-1]):
		if char != s[i + 1]:
			return [i + 1, i + 2]
	return [-1, -1]
for _ in range(int(input())):
	print(*solve())


def balanced(n, s):
	for i in range(1, n):
		if s[i] != s[i - 1]:
			return (i, i + 1)
	return (-1, -1)
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	ans = balanced(n, s)
	print(ans[0], ans[1])


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	flag = False
	pos = -1
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			pos = i
			flag = True
			break
	if flag:
		print(pos + 1, pos + 2)
	else:
		print(-1, -1)


for i in range(int(input())):
	n = int(input())
	s = input()
	p = -1
	a = b = 0
	for j in range(n):
		if s[j] == 'a':
			a = 1
		if s[j] == 'b':
			b = 1
		if a == 1 and b == 1:
			p = j
			break
	if p == -1:
		print('-1 -1')
	else:
		print(str(j) + ' ' + str(j + 1))


for _ in range(int(input())):
	n = int(input())
	s = input()
	p = 0
	if 'a' in s:
		p += 1
	if 'b' in s:
		p += 1
	if p < 2:
		print('-1 -1')
	elif 'ab' in s:
		z = s.index('ab')
		print(str(z + 1) + ' ' + str(z + 2))
	else:
		z = s.index('ba')
		print(str(z + 1) + ' ' + str(z + 2))


for i in range(int(input())):
	n = int(input())
	s = str(input())
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


def func(s):
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			return [i + 1, i + 2]
	else:
		return [-1, -1]
t = int(input())
while t:
	input()
	print(*func(input()))
	t -= 1


t = int(input())
l = []
for i in range(t):
	n = int(input())
	s = input()
	j = 1
	k = c = 0
	while k < len(s) and j < len(s):
		if s[k] != s[j]:
			c += 1
			l.append([k + 1, j + 1])
			break
		j += 1
		k += 1
	if c == 0:
		l.append([-1, -1])
for i in l:
	print(*i)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	total = 0
	for i in range(len(s)):
		flag = 0
		a = 0
		b = 0
		for j in range(i, len(s)):
			if s[j] == 'a':
				a += 1
			else:
				b += 1
			if a == b:
				flag = 1
				total = 1
				print(i + 1, j + 1)
				break
		if flag == 1:
			break
	if total == 0:
		print(-1, -1)


def main() -> None:
	for t in range(int(input())):
		n = int(input())
		s = input()
		found = False
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				print(str(i + 1) + ' ' + str(i + 2))
				found = True
				break
		if not found:
			print('-1 -1')
main()


inp = int(input())
l_1 = []
l_2 = []
for i in range(inp):
	l_1.append(input())
	l_2.append(input())
for j in l_2:
	if len(j) < 2:
		print(-1, -1)
	elif 'a' not in j or 'b' not in j:
		print(-1, -1)
	else:
		oo = []
		for i in range(len(j) - 1):
			if j[i] != j[i + 1]:
				oo.append(i)
		print(oo[0] + 1, oo[0] + 2)


for i in range(int(input())):
	n = int(input())
	s = input()
	c_ = s[0]
	for i in range(1, n):
		if c_ != s[i]:
			print(i, i + 1)
			break
	else:
		print(-1, -1)


def balancedSubstring(n, s):
	if len(s) > 1:
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				print(i + 1, i + 2)
				return
	print(-1, -1)
t = int(input())
for i in range(t):
	n = int(input())
	st = input()
	balancedSubstring(n, st)


import sys
import math
import bisect
from functools import reduce, lru_cache
from collections import Counter, namedtuple, deque, defaultdict
from itertools import groupby, permutations

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()
for _ in range(getN()):
	n = getN()
	s = input()
	for i in range(n - 1):
		if s[i] + s[i + 1] in ('ab', 'ba'):
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


def int_input():
	a = int(input())
	return a

def int_list_input():
	a = list(map(int, input().split()))
	return a

def solve():
	n = int(input())
	s = input()
	for i in range(n - 1):
		if s[i] == 'a' and s[i + 1] == 'b' or (s[i + 1] == 'a' and s[i] == 'b'):
			print(i + 1, i + 2)
			return
	print(-1, -1)
for _ in range(int(input())):
	solve()


def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def solve(A, n):
	f = 0
	for i in range(n):
		res = 0
		for j in range(i, n):
			if A[j] == 'a':
				res += 1
			else:
				res -= 1
			if res == 0:
				f = 1
				print(i + 1, j + 1)
				break
		if f:
			break
	if f == 0:
		print(-1, -1)
for _ in range(int(input())):
	n = int(input())
	A = input()
	solve(A, n)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	if s.count('a') * s.count('b') == 0:
		print(-1, -1)
	else:
		for i in range(1, n):
			if s[i] != s[i - 1]:
				print(i, i + 1)
				break


for _ in range(int(input())):
	n = int(input())
	s = input()
	(l, r) = (-1, -1)
	if n <= 1:
		print(l, r)
	else:
		for i in range(n - 1):
			if s[i] == 'a' and s[i + 1] == 'b' or (s[i] == 'b' and s[i + 1] == 'a'):
				(l, r) = (i + 1, i + 2)
				break
		print(l, r)


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = {0: 0}
	c = 0
	for (i, x) in enumerate(s):
		if x == 'a':
			c += 1
		else:
			c -= 1
		if c in a:
			print(a[c] + 1, i + 1)
			break
		a[c] = i + 1
	else:
		print(-1, -1)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()[:-1]
	if 'a' in s and (not 'b' in s) or ('b' in s and (not 'a' in s)):
		print(-1, -1)
		continue
	for i in range(n - 1):
		if s[i] == 'a' and s[i + 1] == 'b' or (s[i] == 'b' and s[i + 1] == 'a'):
			print(i + 1, i + 2)
			break


import sys
from bisect import bisect_right as lb
from collections import deque
from queue import PriorityQueue as pq
from math import gcd
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
lii = lambda : list(map(int, list(ip())))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
for _ in range(ii()):
	n = ii()
	s = ip()
	fl = 0
	for i in range(n):
		a = 0
		b = 0
		fl = 0
		for j in range(i, n):
			a += s[j] == 'a'
			b += s[j] == 'b'
			if a == b:
				print(i + 1, j + 1)
				fl = 1
				break
		if fl:
			break
	if fl == 0:
		print(-1, -1)


t = int(input())
for hh in range(0, t):
	n = int(input())
	s = input()
	if n == 1:
		print(-1, -1)
	else:
		flag = 0
		for i in range(0, n - 1):
			if s[i] != s[i + 1]:
				print(i + 1, i + 2)
				flag = 1
				break
		if flag == 0:
			print(-1, -1)


try:
	for _ in range(int(input())):
		n = int(input())
		s = input()
		pos = s.find('ab')
		if pos != -1:
			print(f'{pos + 1} {pos + 2}')
			continue
		pos = s.find('ba')
		if pos != -1:
			print(f'{pos + 1} {pos + 2}')
		else:
			print('-1 -1')
except:
	pass


def solve():
	T = int(input())
	for i in range(T):
		n = int(input())
		str = input()
		check = 0
		for i in range(n - 1):
			if str[i] != str[i + 1]:
				print(i + 1, i + 2)
				check = 1
				break
		if check == 0:
			print(-1, -1)
solve()


n = int(input())
S = []
for i in range(0, n):
	a = input()
	S.append(input())
for i in range(0, n):
	a = 0
	b = 0
	K = 0
	for k in range(0, len(S[i])):
		if S[i][k] == 'a':
			a += 1
			if b != 0:
				K = k
				break
		if S[i][k] == 'b':
			b += 1
			if a != 0:
				K = k
				break
	if K != 0:
		print(K, K + 1)
	else:
		print(-1, -1)


def u():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	s = input()
	f = False
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			f = True
			break
	if not f:
		print('-1 -1')


def codeforces1569A_solution(xs):
	if xs.count('a') == 0 or xs.count('b') == 0:
		return (-1, -1)
	(current, begin) = (xs[0], 1)
	for (i, x) in enumerate(xs[1:]):
		if current == x:
			begin += 1
		else:
			return (begin, i + 2)

def codeforces1569A():
	for _ in range(int(input())):
		n = int(input())
		s = input()
		(a, b) = codeforces1569A_solution(s)
		print(a, b)
codeforces1569A()


def solution():
	for t in range(int(input())):
		n = int(input())
		s = input()
		(l, r) = (-1, -1)
		(sa, sb) = (s.find('a'), s.find('b'))
		if sa == -1 or sb == -1:
			pass
		else:
			r = max(sa, sb) + 1
			l = r - 1
		print('{0:} {1:}'.format(l, r))
	return
solution()


import sys
from bisect import *
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def dadd(d, p, val):
	if p in d:
		d[p].append(val)
	else:
		d[p] = [val]

def gi():
	return [xx for xx in input().split()]

def gtc(tc, *ans):
	print('Case #' + str(tc) + ':', *ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def bits(i, n):
	p = bin(i)[2:]
	return (n - len(p)) * '0' + p

def prec(a, pre):
	for i in a:
		pre.append(pre[-1] + i)
	pre.pop(0)

def YN(flag):
	print('YES' if flag else 'NO')

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
INF = 10 ** 18
uu = t
mod = 10 ** 9 + 7
while t > 0:
	t -= 1
	n = fi()
	s = ii()
	p = q = -1
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			p = i + 1
			q = i + 2
			break
	print(p, q)


import bisect
import heapq
import math
import sys
input = lambda : sys.stdin.readline().rstrip()

def solve():
	n = int(input())
	s = input()
	a = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i - 1] == 'a':
			a[i] += 1
		a[i] += a[i - 1]
	for l in range(1, n + 1):
		for r in range(l, n + 1):
			if a[r] - a[l - 1] == (r - l + 1) // 2 and (r - l) % 2 == 1:
				print(l, r)
				return
	print(-1, -1)
import random
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = input()
	per = s[0]
	ans = 0
	for i in range(1, n):
		if s[i] != per:
			ans = i
			break
	if ans:
		print(ans, ans + 1)
	else:
		print(-1, -1)


for _ in range(int(input())):
	input()
	s = input()
	if 'ab' not in s and 'ba' not in s:
		print(-1, -1)
	elif 'ab' in s:
		print(s.index('ab') + 1, s.index('ab') + 2)
	else:
		print(s.index('ba') + 1, s.index('ba') + 2)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	if len(set(s)) == 1:
		print(-1, -1)
	else:
		for i in range(1, n):
			if s[i - 1] != s[i]:
				print(i, i + 1)
				break


from sys import stdin, stdout
number_test = int(stdin.readline())
list_to_print = []

def show_result():
	test_index = stdin.readline()
	s_str = stdin.readline().strip('\n')
	if len(s_str) == 1:
		stdout.write('-1 -1\n')
	else:
		for x in range(len(s_str) - 1):
			if s_str[x] != s_str[x + 1]:
				stdout.write(str(x + 1) + ' ' + str(x + 2) + '\n')
				return
		stdout.write('-1 -1\n')
for i in range(number_test):
	show_result()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main(t):
	n = int(input())
	s = input()
	accu = [0] * (n + 1)
	dic = {0: -1}
	ans = [-1, -1]
	for i in range(n):
		if s[i] == ord('a'):
			accu[i] = accu[i - 1] + 1
		else:
			accu[i] = accu[i - 1] - 1
		if accu[i] not in dic:
			dic[accu[i]] = i
		else:
			ans = [dic[accu[i]] + 2, i + 1]
			break
	print(ans[0], ans[1])
T = int(input())
t = 1
while t <= T:
	main(t)
	t += 1


for i in range(int(input())):
	k = int(input())
	fl = False
	s = input()
	for j in range(1, k):
		if s[j] != s[j - 1]:
			print(j, j + 1)
			fl = True
			break
	if not fl:
		print(-1, -1)


numcases = int(input())
for i in range(numcases):
	input()
	str = input()
	start = str[0]
	first = 0
	if start == 'a':
		first = str.find('b')
	else:
		first = str.find('a')
	if first == -1:
		print('-1 -1')
	else:
		print(first, first + 1)


from collections import Counter, defaultdict, OrderedDict, deque
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from typing import List
import itertools
import math
import heapq
import string
import random
(MIN, MAX, MOD) = (-1061109567, 1061109567, 1000000007)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
for _ in range(N()):
	n = N()
	s = input()
	if len(set(s)) == 1:
		print(-1, -1)
		continue
	mx = max(s.index('a'), s.index('b'))
	print(mx, mx + 1)


a = int(input())
for x in range(a):
	b = int(input())
	c = input()
	counta = 0
	countb = 0
	count3 = 0
	d = 0
	e = 0
	for i in range(b - 1):
		if c[i] == 'a' and c[i + 1] == 'b':
			d = i + 1
			e = i + 2
			break
		elif c[i] == 'b' and c[i + 1] == 'a':
			d = i + 1
			e = i + 2
			break
	if d == 0 and e == 0:
		print(-1, -1)
	else:
		print(d, e)


for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if len(set(s)) == 1:
		print(-1, -1)
		continue
	else:
		l = -1
		r = -1
		for i in range(1, n):
			if s[i] != s[i - 1]:
				l = i - 1
				r = i
				break
		print(l + 1, r + 1)


k = int(input())
for i in range(k):
	n = int(input())
	c = input()
	a = c.count('a')
	b = c.count('b')
	if a != b:
		maxi = 0
		for i in range(n):
			if maxi != 0:
				break
			for j in range(i + 1, n + 1):
				a = c[i:j].count('a')
				b = c[i:j].count('b')
				if a == b:
					maxi = len(c[i:j])
					print(i + 1, j)
					break
		if maxi == 0:
			print(-1, -1)
	else:
		print(1, len(c))


for _ in range(int(input())):
	n = int(input())
	s = input()
	if len(set(s)) == 1:
		print(-1, -1)
	else:
		m = max(s.index('a'), s.index('b'))
		print(m, m + 1)


def sol():
	n = int(input())
	s = input()
	wyn = 0
	pop = {0: 0}
	for i in range(1, n):
		wyn = ord(s[i]) + ord(s[i - 1])
		if wyn == ord('a') + ord('b'):
			return f'{i} {i + 1}'
	return '-1 -1'

def main():
	for i in range(int(input())):
		print(sol())
main()


cases = int(input())
while cases > 0:
	len = int(input())
	s = input()
	li = list(s)
	for i in range(len - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)
	cases -= 1


def process(S):
	counts = {}
	diff = 0
	n = len(S)
	counts[0] = 0
	for i in range(n):
		if S[i] == 'a':
			diff += 1
		else:
			diff -= 1
		if diff in counts:
			return [counts[diff] + 1, i + 1]
		counts[diff] = i + 1
	return [-1, -1]
t = int(input())
for i in range(t):
	n = int(input())
	S = input()
	(l, r) = process(S)
	print(f'{l} {r}')


for _ in range(int(input())):
	n = int(input())
	s = input()
	l = []
	for i in range(n):
		if s[i] == 'a':
			l.append(1)
		else:
			l.append(-1)
	for i in range(len(l) - 1):
		if l[i] + l[i + 1] == 0:
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


t = int(input(''))
for i in range(t):
	n = int(input(''))
	s = input('')
	start = s[0]
	end = 'a' if start == 'b' else 'b'
	res = s.find(end)
	if res == -1:
		print('-1 -1')
	else:
		print(res, res + 1)


for _ in range(int(input())):
	n = int(input())
	s = input()
	fl = 0
	if n == 2:
		if s.count('a') == s.count('b'):
			print(1, 2)
		else:
			print(-1, -1)
	else:
		for i in range(2, n, 2):
			for j in range(n - i + 1):
				if s[j:j + i].count('a') == s[j:j + i].count('b'):
					print(j + 1, j + i)
					fl = 1
					break
			if fl:
				break
		else:
			print(-1, -1)


_ = 1
_ = int(input())
while _ > 0:
	_ -= 1
	n = int(input())
	s = input()
	(a, b) = (0, 0)
	for x in range(n - 1):
		if s[x] == 'a' and s[x + 1] == 'b' or (s[x] == 'b' and s[x + 1] == 'a'):
			print(x + 1, x + 2)
			break
	else:
		print('-1 -1')


t = int(input())
for inh in range(0, t):
	n = int(input())
	s = input()
	i = 0
	ans = True
	while i < n - 1 and ans:
		if s[i] == 'a' and s[i + 1] == 'b' or (s[i] == 'b' and s[i + 1] == 'a'):
			ans = False
		else:
			i += 1
	if ans:
		print(-1, -1)
	else:
		print(i + 1, i + 2)


import sys

def I():
	return int(sys.stdin.readline().rstrip())

def MI():
	return map(int, sys.stdin.readline().rstrip().split())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def LI2():
	return list(map(int, sys.stdin.readline().rstrip()))

def S():
	return sys.stdin.readline().rstrip()

def LS():
	return list(sys.stdin.readline().rstrip().split())

def LS2():
	return list(sys.stdin.readline().rstrip())
t = I()
for _ in range(t):
	n = I()
	s = S()
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			print(i + 1, i + 2)
			break
	else:
		print(-1, -1)


t = int(input())
for k in range(t):
	n = int(input())
	s = input()
	ans = [-1, -1]
	for i in range(n - 1):
		if s[i] == 'a' and s[i + 1] == 'b' or (s[i + 1] == 'a' and s[i] == 'b'):
			ans = [i + 1, i + 2]
			break
	print(*ans)


time = int(input())

def zalupa(a):
	if len(a) == 1:
		return '-1 -1'
	for i in range(1, len(a)):
		if a[i - 1] != a[i]:
			return str(i) + ' ' + str(i + 1)
	return '-1 -1'
for i in range(time):
	n = int(input())
	s = input()
	print(zalupa(s))


import os, sys
from io import BytesIO, IOBase
from math import log2, ceil, sqrt, gcd
from _collections import deque
import heapq as hp
from bisect import bisect_left, bisect_right
from math import cos, sin
from itertools import permutations
from operator import itemgetter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = [i for i in input()]
	if len(set(a)) == 1:
		print(-1, -1)
	else:
		for i in range(n - 1):
			if a[i] != a[i + 1]:
				print(i + 1, i + 2)
				break


for _ in range(int(input())):
	n = int(input())
	s = str(input())
	if n == 1:
		print(-1, -1)
	else:
		a = 0
		b = 0
		on = 0
		for i in range(len(s) - 1):
			if s[i] != s[i + 1]:
				a = i + 1
				b = i + 2
				print(a, b)
				break
		else:
			print(-1, -1)