There is a robot on a coordinate plane. Initially, the robot is located at the point $(0, 0)$. Its path is described as a string $s$ of length $n$ consisting of characters 'L', 'R', 'U', 'D'.

Each of these characters corresponds to some move:   'L' (left): means that the robot moves from the point $(x, y)$ to the point $(x - 1, y)$;  'R' (right): means that the robot moves from the point $(x, y)$ to the point $(x + 1, y)$;  'U' (up): means that the robot moves from the point $(x, y)$ to the point $(x, y + 1)$;  'D' (down): means that the robot moves from the point $(x, y)$ to the point $(x, y - 1)$. 

The company that created this robot asked you to optimize the path of the robot somehow. To do this, you can remove any non-empty substring of the path. But this company doesn't want their customers to notice the change in the robot behavior. It means that if before the optimization the robot ended its path at the point $(x_e, y_e)$, then after optimization (i.e. removing some single substring from $s$) the robot also ends its path at the point $(x_e, y_e)$.

This optimization is a low-budget project so you need to remove the shortest possible non-empty substring to optimize the robot's path such that the endpoint of his path doesn't change. It is possible that you can't optimize the path. Also, it is possible that after the optimization the target path is an empty string (i.e. deleted substring is the whole string $s$).

Recall that the substring of $s$ is such string that can be obtained from $s$ by removing some amount of characters (possibly, zero) from the prefix and some amount of characters (possibly, zero) from the suffix. For example, the substrings of "LURLLR" are "LU", "LR", "LURLLR", "URL", but not "RR" and "UL".

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The next $2t$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the length of the robot's path. The second line of the test case contains one string $s$ consisting of $n$ characters 'L', 'R', 'U', 'D' — the robot's path.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$ ($\sum n \le 2 \cdot 10^5$).


-----Output-----

For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $l$ and $r$ such that $1 \le l \le r \le n$ — endpoints of the substring you remove. The value $r-l+1$ should be minimum possible. If there are several answers, print any of them.


-----Example-----
Input
4
4
LRUD
4
LURD
5
RRUDU
5
LLDDR

Output
1 2
1 4
3 4
-1

Difficulty: introductory

Starter code:

Solutions:
for _ in range(int(input())):
    n = int(input())
    s = input()
    balance = 0
    index = {0: 1}
    ans = [10**9]
    i = 1
    for x in s:
        if x == 'U':
            balance += 10 ** 9
        elif x == 'D':
            balance -= 10 ** 9
        elif x == 'L':
            balance += 1
        else:
            balance -= 1
        if balance in index:
            ans = min(ans, [i + 1 - index[balance], index[balance], i])
        index[balance] = i + 1
        i += 1
    if ans[0] == 10 ** 9:
        print(-1)
    else:
        print(ans[1], ans[2])


from sys import stdin
input = stdin.readline
q = int(input())
N = 2342379478943
for rwwe in range(q):
	n = int(input())
	s = input()
	k = []
	for i in range(n):
		if s[i] == "L":
			k.append(1)
		if s[i] == "R":
			k.append(-1)
		if s[i] == "U":
			k.append(N)
		if s[i] == "D":
			k.append(-N)
	pref = [0] * (n+1)
	for i in range(1,n+1):
		pref[i] = pref[i-1] + k[i-1]
	#print(pref)############
	d = {}
	for i in pref:
		d[i] = []
	for i in range(len(pref)):
		d[pref[i]].append(i)
	best = 10000000000
	odp = ["a","a"]
	#print(d)##########
	for i in d:
		if len(d[i]) < 2:
			continue
		else:
			for j in range(1,len(d[i])):
				if d[i][j]-d[i][j-1] < best:
					best = d[i][j]-d[i][j-1]
					odp = [d[i][j-1]+1,d[i][j]]
	if odp != ["a","a"]:
		print(*odp)
	else:
		print(-1)


import sys
input = sys.stdin.readline
from collections import defaultdict

t=int(input())
for tests in range(t):
    n=int(input())
    S=input().strip()

    ANS=1<<31
    D=defaultdict(list)

    NOW=[0,0]
    TIME=0
    D[tuple(NOW)].append(TIME)
    TIME+=1

    for s in S:
        if s=="U":
            NOW[0]+=1
        elif s=="D":
            NOW[0]-=1
        elif s=="R":
            NOW[1]+=1
        else:
            NOW[1]-=1

        D[tuple(NOW)].append(TIME)
        TIME+=1

        if len(D[tuple(NOW)])>1 and ANS>D[tuple(NOW)][-1]-D[tuple(NOW)][-2]:
            ANS=D[tuple(NOW)][-1]-D[tuple(NOW)][-2]
            ANSX=(D[tuple(NOW)][-2]+1,D[tuple(NOW)][-1])

    if ANS==1<<31:
        print(-1)
    else:
        print(*ANSX)
                
            
            
            

    
    


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()

	position_to_step = {(0, 0): 0}
	len_of_min = n+1
	ans = (0, 0)
	pos = (0, 0)

	for i in range(n):
		item = s[i]
		if  item == "U":
			pos = (pos[0], pos[1]+1)
		elif  item == "D":
			pos = (pos[0], pos[1]-1)
		if  item == "R":
			pos = (pos[0]+1, pos[1])
		if  item == "L":
			pos = (pos[0]-1, pos[1])

		if pos in position_to_step:
			if i - position_to_step[pos] < len_of_min:
				len_of_min = i - position_to_step[pos]
				ans = position_to_step[pos], i

		position_to_step[pos] = i+1

	if ans[0] == ans[1]:
		print(-1)
	else:
		print(ans[0]+1, ans[1]+1)


import sys

# inf = open('input.txt', 'r')
# reader = (line.rstrip() for line in inf)
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__

t = int(input())
for _ in range(t):
    n = int(input())
    coms = list(input())
    pos = {(0, 0):-1}
    x = y = 0
    l = -1
    r = float('inf')
    for i, d in enumerate(coms):
        if d == 'L':
            x -= 1
        elif d == 'R':
            x += 1
        elif d == 'U':
            y += 1
        else:
            y -= 1
        
        if (x, y) in pos:
            prev = pos[(x, y)]
            if i - prev < r - l:
                r, l = i, prev
        pos[(x, y)] = i
    
    if r == float('inf'):
        print(-1)
    else:
        print(l + 2, r + 1)

# inf.close()


for _ in range(int(input())):
    n = int(input())
    ar = list(input())
    left, right = 0, 0
    kek = [[0, 0, 0]]
    for i in range(n):
        elem = ar[i]
        if elem == 'L':
            left -= 1
        elif elem == 'R':
            left += 1
        elif elem == 'U':
            right += 1
        else:
            right -= 1
        kek.append([left, right, i + 1])
    kek.sort()
    ans = 10 ** 9
    a, b = -1, -1
    for i in range(n + 1):
        if kek[i][0] == kek[i - 1][0] and kek[i][1] == kek[i - 1][1] and kek[i][2] - kek[i - 1][2] < ans:
            ans = kek[i][2] - kek[i - 1][2]
            a, b = kek[i - 1][2] + 1, kek[i][2]
    if a == b == -1:
        print(-1)
    else:
        print(a, b)

from collections import Counter
t = int(input())
inf = 10**18
for _ in range(t):
    n = int(input())
    s = input()
    ans = [inf, 0, 0]
    cnt = Counter({(0, 0): 1})
    x, y = 0, 0

    for i, c in enumerate(s, start=1):
        if c == 'L':
            x -= 1
        elif c == 'R':
            x += 1
        elif c == 'U':
            y -= 1
        else:
            y += 1
        if (x, y) in cnt and i - cnt[(x, y)] < ans[0]:
            ans[0] = i - cnt[(x, y)]
            ans[1], ans[2] = cnt[(x, y)], i
        cnt[(x, y)] = i+1

    if ans[0] < inf:
        print(ans[1], ans[2])
    else:
        print(-1)


import sys
input = sys.stdin.readline
def getInt(): return int(input())
def getVars(): return list(map(int, input().split()))
def getList(): return list(map(int, input().split()))
def getStr(): return input().strip()
## -------------------------------



t = getInt()
for _ in range(t):
    n = getInt()
    s = getStr()
    d = {}
    d['0/0'] = 0
    x = 0
    y = 0
    res = [0, n+1]
    for i in range(n):
        if s[i] == 'L':
            x -= 1
        if s[i] == 'R':
            x += 1
        if s[i] == 'U':
            y += 1
        if s[i] == 'D':
            y -= 1
        k = str(x) + '/' + str(y)
        if k not in d:
            d[k] = i+1
        else:
            if i+1 - d[k] < res[1] - res[0]:
                res = [d[k]+1, i+1]
            d[k] = i+1
    if res[1] == n+1:
        print(-1)
    else:
        print(*res)
    










import sys
input=sys.stdin.readline

t=int(input())
for _ in range(t):
    n=int(input())
    it=list(input())
    ss={}
    x=0
    y=0
    ss[(0,0)]=-1
    mi=n+1
    ans=[]
    for i in range(n):
        if it[i]=="L":
            x-=1
        elif it[i]=="R":
            x+=1
        elif it[i]=="U":
            y+=1
        else:
            y-=1
       # if x==0 and y==0:
        #    print(_)
       # print(x,y)
        try:
            xx=ss[(x,y)]
            if i+1-xx-2+1<mi:
                mi=i+1-xx-2+1
                ans=[xx+2,i+1]
        except:
            pass
        ss[(x,y)]=i
    if ans==[]:
        print(-1)
        continue
    print(*ans)



t = int(input())

for loop in range(t):

    n = int(input())

    s = input()

    x = 0
    y = 0

    dic = {}
    dic[(0,0)] = -1

    ansl = float("-inf")
    ansr = float("inf")

    for i,S in enumerate(s):

        if S == "L":
            x -= 1
        elif S == "R":
            x += 1
        elif S == "U":
            y += 1
        elif S == "D":
            y -= 1

        if (x,y) in dic:
            nowl = dic[(x,y)]
            nowr = i

            if nowr - nowl < ansr - ansl:
                ansl = nowl
                ansr = nowr
            
        dic[(x,y)] = i

    if ansr == float("inf"):
        print(-1)
    else:
        print(ansl+2,ansr+1)
       


t = int(input())
for y in range(t):
	n = int(input())
	s = input()
	pre = [0 for i in range(n+1)]
	for i in range(n):
		if(s[i] == 'L'): pre[i+1] = pre[i]+1
		elif(s[i] == 'R'): pre[i+1] = pre[i]-1
		elif(s[i] == 'U'): pre[i+1] = pre[i]+int(1e6)
		else: pre[i+1] = pre[i]-int(1e6)
	#print(pre)
	d = dict()
	ans = -1
	l = r = -1
	for i in range(n+1):
		if pre[i] not in d:
			d[pre[i]] = i
		else:
			if ans == -1 or i - d[pre[i]] < ans:
				ans  = i - d[pre[i]]
				l = d[pre[i]]+1
				r = i
			d[pre[i]] = i
	if(ans == -1): print(ans)
	else: print(l,r)


def one():
    return int(input())


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


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


def st():
    return input()


for i in range(one()):
    input()
    d = {(0, 0): 0}
    s = st()
    c = [0, 0]
    r = 0
    m = float('inf')
    ans = None
    for j in s:
        if j == 'U':
            c[1] += 1
        if j == 'D':
            c[1] -= 1
        if j == 'R':
            c[0] += 1
        if j == 'L':
            c[0] -= 1
        r += 1
        if (c[0], c[1]) in d:
            if m > r - d[(c[0], c[1])] + 1:
                ans = (d[(c[0], c[1])] + 1, r)
                m = r - d[(c[0], c[1])] + 1
            d[(c[0], c[1])] = r
        else:
            d[(c[0], c[1])] = r
    if not ans:
        print(-1)
    else:
        print(*ans)


from collections import defaultdict
import sys
input = sys.stdin.readline
def case():
    n = int(input())
    s = input().strip()
    t = 1
    x, y = 0, 0
    d = defaultdict(list)
    d[(0, 0)].append(0)
    anslen = 10**10
    ans = []
    for i in s:
        if i == 'L':
            x-=1
        elif i == 'R':
            x+=1
        elif i == 'D':
            y-=1
        elif i == 'U':
            y+=1
        if d[(x, y)] != []:
            if t-d[(x, y)][-1] < anslen:
                anslen = t-d[(x, y)][-1]
                ans = [d[(x, y)][-1], t]
        d[(x, y)].append(t)
        t+=1
    if anslen == 10**10:
        print(-1)
    else:
        print(ans[0]+1, ans[1])
for _ in range(int(input())):
    case()

import sys
input = sys.stdin.readline

dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
R = {'L' : 0, 'R' : 1, 'U' : 2, 'D' : 3}

T = int(input())

for _ in range(T):
    x = y = 0
    N = int(input())
    Path = input().rstrip()

    vst = {(0, 0) : 0}
    ans = []
    for i in range(N):
        #print(x, y)
        r = R[Path[i]]
        x += dx[r]
        y += dy[r]
        if (x, y) in vst:
            w = i - vst[(x, y)]
            ans.append((w, vst[(x, y)] + 1, i + 1))

        vst[(x, y)] = i + 1
    ans.sort()

    if ans:
        print(ans[0][1], ans[0][2])
    else:
        print(-1)




for _ in range(int(input())):
    n = int(input())
    s = list(input())
    d1 = {}
    d1[(0, 0)] = [0]
    x, y = 0, 0
    i = 1
    for c in s:
        if c =="L":
            x-=1
        if c=="R":
            x+=1
        if c=="U":
            y+=1
        if c=="D":
            y-=1
        if (x,y) in d1:
            d1[(x, y)].append(i)
        else :
            d1[(x,y)] = [i]
        i+=1
    answer = -1
    answer_coord = [0, 0]
    for x in d1:
        if len(d1[x]) > 1:
            d1[x].sort()
            for i in range(len(d1[x]) - 1):
                if answer == -1:
                    answer = d1[x][i+1] - d1[x][i]
                    answer_coord = [d1[x][i+1], d1[x][i]]
                elif d1[x][i+1] - d1[x][i] < answer:
                    answer = d1[x][i+1] - d1[x][i]
                    answer_coord = [d1[x][i+1], d1[x][i]]
    a = answer_coord[1]
    b = answer_coord[0]
    if answer!=-1:
        print(a + 1, b)
    else :
        print(-1)

for i in range(int(input())):
	n = int(input())
	s = input()
	d = {}
	x = 0
	y = 0
	d[(x,y)] = [0]
	m1 = -1
	m2 = -1
	c = 0
	for i in s:
		c+=1
		if(i=="L"):
			x-=1
		elif(i=="R"):
			x+=1
		elif(i=="U"):
			y+=1
		else:
			y-=1
		try:
			d[(x, y)].append(c)
			if(m1==-1):
				m2 = d[(x, y)][-1]
				m1 = d[(x, y)][-2]
			if(d[(x, y)][-1] - d[(x, y)][-2])<(m2 - m1):
				m2 = d[(x, y)][-1]
				m1 = d[(x, y)][-2]
		except:
			d[(x,y)] = [c]
	#print(d)
	if(m1!=-1):
		print(str(m1+1)+" "+str(m2))
	else:
		print(-1)

t = int(input())

while t:
    t -= 1
    n = int(input())
    s = list(input())
    a = [(-1 if s[i] == 'L' else (1 if s[i] == 'R' else 0)) for i in range(n)]
    b = [(-1 if s[i] == 'D' else (1 if s[i] == 'U' else 0)) for i in range(n)]
    suma = [a[0] for _ in range(n)]
    sumb = [b[0] for _ in range(n)]
    d = dict()
    d[(0, 0)] = -1
    for i in range(1, n):
        suma[i] = suma[i - 1] + a[i]
        sumb[i] = sumb[i - 1] + b[i]
    res = n + 1
    _res = -1
    for i in range(n):
        #print(suma[i], sumb[i])
        if (suma[i], sumb[i]) in d.keys():
            if res > i - d[(suma[i], sumb[i])]:
                res = i - d[(suma[i], sumb[i])]
                _res = (d[(suma[i], sumb[i])], i)
        d[(suma[i], sumb[i])] = i
    if (_res == -1):
        print(_res)
    else:
        print(_res[0] + 2, _res[1] + 1)