You are given a string $s$ consisting of $n$ lowercase Latin letters.

Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position $3$ and ends in position $6$), but "aa" or "d" aren't substrings of this string. So the substring of the string $s$ from position $l$ to position $r$ is $s[l; r] = s_l s_{l + 1} \dots s_r$.

You have to choose exactly one of the substrings of the given string and reverse it (i. e. make $s[l; r] = s_r s_{r - 1} \dots s_l$) to obtain a string that is less lexicographically. Note that it is not necessary to obtain the minimum possible string.

If it is impossible to reverse some substring of the given string to obtain a string that is less, print "NO". Otherwise print "YES" and any suitable substring.

String $x$ is lexicographically less than string $y$, if either $x$ is a prefix of $y$ (and $x \ne y$), or there exists such $i$ ($1 \le i \le min(|x|, |y|)$), that $x_i < y_i$, and for any $j$ ($1 \le j < i$) $x_j = y_j$. Here $|a|$ denotes the length of the string $a$. The lexicographic comparison of strings is implemented by operator < in modern programming languages​​.


-----Input-----

The first line of the input contains one integer $n$ ($2 \le n \le 3 \cdot 10^5$) — the length of $s$.

The second line of the input contains the string $s$ of length $n$ consisting only of lowercase Latin letters.


-----Output-----

If it is impossible to reverse some substring of the given string to obtain a string which is lexicographically less, print "NO". Otherwise print "YES" and two indices $l$ and $r$ ($1 \le l < r \le n$) denoting the substring you have to reverse. If there are multiple answers, you can print any.


-----Examples-----
Input
7
abacaba

Output
YES
2 5

Input
6
aabcfg

Output
NO



-----Note-----

In the first testcase the resulting string is "aacabba".

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Sorting

Implementation


Solutions:
n = int(input())
sen = input()
for i in range(0, n - 1, 1):
	if sen[i] > sen[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit(0)
print('NO')


ll = lambda : list(kk())
(n, l) = (int(input()), input())
for i in range(n - 1):
	if l[i] > l[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


_ = input()
x = input()
start = 0
for (i, ch) in enumerate(x):
	if i == 0:
		continue
	if x[start] > ch:
		print('YES')
		print(start + 1, i + 1)
		break
	if ch > x[start]:
		start = i
else:
	print('NO')


n = int(input())
s = input()
for i in range(n - 1):
	if s[i + 1] < s[i]:
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


n = int(input())
s = input()
t = sorted(s)
flag = False
for i in range(n):
	if s[i] != t[i]:
		flag = True
		break
if flag == False:
	print('NO')
else:
	print('YES')
	for j in range(i + 1, n):
		if s[j] < s[i]:
			print(i + 1, j + 1)
			break


N = int(input())
string = list(input())
last = string[-1]
c_index = 0
for index in range(0, N):
	if ord(string[index]) < ord(string[c_index]):
		print('YES')
		print(c_index + 1, index + 1)
		break
	elif ord(string[index]) > ord(string[c_index]):
		c_index = index
else:
	print('NO')


num = int(input())
word = input()

def lexboy(n, string):
	for i in range(1, n):
		if string[i] < string[i - 1]:
			return 'YES \n' + str(i) + ' ' + str(i + 1)
	return 'NO'
print(lexboy(num, word))


import sys
T = int(input())
s = input()
pre = s[0]
tag = 0
for i in range(1, T):
	if s[i] >= pre:
		pre = s[i]
	else:
		tag = 1
		print('YES')
		print(i, i + 1)
		break
if tag == 0:
	print('NO')


(n, s) = (input(), input())
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES\n', i + 1, ' ', i + 2, sep='')
		exit()
print('NO')


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')

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 SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)
n = int(input())
s = input()
for i in range(0, len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


ln = int(input())
string = str(input())
max_letter = '\x00'
i_max_letter = -1
for i in range(len(string)):
	if string[i] < max_letter:
		print('YES')
		print('%s %s' % (i_max_letter + 1, i + 1))
		exit()
	if max_letter < string[i]:
		max_letter = string[i]
		i_max_letter = i
print('NO')


n = int(input())
s = input()
num = s[0]
ans = -1
for i in range(1, n):
	if s[i] < num:
		ans = i
		break
	num = s[i]
if ans == -1:
	print('NO')
else:
	print('YES')
	print(ans, ans + 1)


n = int(input())
string = input()
flag = 0
for i in range(0, n - 1):
	if string[i] > string[i + 1]:
		flag = 1
		print('YES')
		print(i + 1, i + 2)
		break
if flag == 0:
	print('NO')


n = int(input())
s = input()
a = list(s)
b = sorted(a)
flag = False
for i in range(n):
	if ord(b[i]) != ord(a[i]):
		flag = True
if flag:
	print('Yes')
	for i in range(n - 1):
		if ord(s[i + 1]) < ord(s[i]):
			ans = [i + 1, i + 2]
			break
	print(*ans)
else:
	print('No')


n = int(input())
s = input()
flag = True
for i in range(n - 1):
	if s[i] <= s[i + 1]:
		continue
	else:
		print('YES')
		print(i + 1, i + 2)
		flag = False
		break
if flag:
	print('NO')


n = int(input())
s = input()
mm = ord(s[0])
l = 1
r = 0
for i in range(1, n):
	if mm < ord(s[i]):
		l = i + 1
		mm = ord(s[i])
	if ord(s[i]) < mm:
		r = i + 1
		break
if r != 0:
	print('YES')
	print(l, r)
else:
	print('NO')


def main():
	n = int(input())
	s = input()
	a = []
	f = 0
	f1 = 0
	for ch in s:
		a.append(ch)
	for i in range(len(a)):
		if i < len(a) - 1 and ord(a[i]) > ord(a[i + 1]):
			ans = 'YES'
			f = i + 1
			f1 = i + 2
			break
		else:
			ans = 'NO'
	print(ans)
	if f != 0 and f1 != 0:
		print(f, f1)
main()


n = int(input())
s = list(input())
flag = 0
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, end=' ')
		print(i + 2)
		flag = 1
		break
if flag == 0:
	print('NO\n')


n = int(input())
s = input()
r = sorted(s)
r = ''.join(r)
if s == r:
	print('NO')
else:
	print('YES')
	for i in range(1, n):
		if s[i] < s[i - 1]:
			print(i, i + 1)
			break


n = int(input())
s = str(input())
c = 0
for i in range(1, n):
	if s[i] >= s[i - 1]:
		c = c + 1
	else:
		break
if c == n - 1:
	print('NO')
else:
	print('YES')
	print(i, i + 1)


n = int(input())
s = input()
mx = 'a'
lol = 0
for i in range(0, n):
	if s[i] >= mx:
		mx = s[i]
		li = i
	else:
		ind = i
		lol = 1
		break
if lol == 0:
	print('NO')
else:
	print('YES')
	print(li + 1, ind + 1)


n = int(input())
s = input()
a = [ord(x) for x in s]
Max = a[0]
index = 0
for i in range(1, n):
	if a[i] < Max:
		print('YES')
		print(index + 1, end=' ')
		print(i + 1)
		exit()
	if a[i] > Max:
		index = i
		Max = a[i]
print('NO')


n = int(input())
a = list(input())
work = False
(l, r) = (0, 0)
l = 1
lv = ord(a[0])
for i in range(1, len(a)):
	if ord(a[i]) >= lv:
		lv = ord(a[i])
		l = i + 1
	else:
		r = i + 1
		work = True
		break
if work:
	print('YES')
	print(l, r)
else:
	print('NO')


a = int(input())
b = list(input())
c = sorted(b)
for j in range(a):
	if b[j] != c[j]:
		t = list(reversed(b))
		t = t.index(c[j])
		t = a - t
		print('YES')
		print(j + 1, t)
		break
else:
	print('NO')


n = int(input())
s = input()
m = 'z'
for i in range(n - 1, -1, -1):
	if s[i] <= m:
		m = s[i]
		ind = i
	else:
		print('YES')
		print(i + 1, ind + 1)
		exit()
print('NO')


n = int(input())
S = input()
mim = ord(S[0])
IN = 1
for i in range(n - 1):
	if IN and ord(S[i]) > ord(S[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		IN = 0
if IN:
	print('NO')


input()
s = input()
m = 0
for (i, c) in enumerate(s):
	if c > s[m]:
		m = i
	elif c < s[m]:
		print('YES\n{} {}'.format(m + 1, i + 1))
		raise SystemExit(0)
else:
	print('NO')


n = int(input())
s = input()
for i in range(1, n):
	if s[i] < s[i - 1]:
		print('YES')
		print(i, i + 1)
		return
print('NO')


n = int(input())
s = input()
if ''.join(sorted(s)) == s:
	print('NO')
else:
	print('YES')
	for i in range(n - 1):
		if ord(s[i]) > ord(s[i + 1]):
			print(i + 1, i + 2)
			exit()


n = int(input())
s = input()
ss = sorted(s)
f = 0
i = 0
while i < n:
	if s[i] != ss[i]:
		f = 1
		break
	i += 1
if f:
	j = i + 1
	while j < n:
		if ss[i] == s[j]:
			break
		j += 1
	print('YES', i + 1, j + 1)
else:
	print('NO')


n = int(input())
s = input()

def solve(n, s):
	if all((s[i] >= s[i - 1] for i in range(1, n))):
		return [-1, -1]
	mi = n - 1
	for i in range(n - 1, -1, -1):
		if s[i] > s[mi]:
			return [i + 1, mi + 1]
		else:
			mi = i
res = solve(n, s)
if res == [-1, -1]:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, res)))


import sys
s = input()
s = input()
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES\n%i %i' % (i + 1, i + 2))
		sys.exit(0)
print('NO')


n = int(input())
s = input()
l = -1
for i in range(1, n):
	if s[i] < s[i - 1]:
		l = i
		break
if l > -1:
	print('YES')
	print(l, l + 1)
else:
	print('NO')


input()
X = input()
XTemp = ''.join(sorted(X))
if XTemp == X:
	print('NO')
	exit()
for i in range(len(X)):
	if X[i] != XTemp[i]:
		for j in range(i, len(X)):
			if X[j] == XTemp[i]:
				print('YES')
				print(i + 1, j + 1)
				exit()


n = int(input())
s = input()
f = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		f = (i + 1, i + 2)
		break
if f:
	print('YES')
	print(f[0], f[1])
else:
	print('NO')


import sys
import math as mt
import bisect
t = 1
for _ in range(t):
	n = int(input())
	s = input()
	d = {}
	for i in range(n):
		if d.get(s[i], -1) == -1:
			d[s[i]] = []
		d[s[i]].append(i)
	for i in range(n):
		ind = -1
		for j in d:
			if j < s[i] and d[j][-1] > i:
				ind = d[j][-1] + 1
				break
		if ind != -1:
			(x, y) = (i + 1, ind)
			break
	if ind == -1:
		print('NO')
	else:
		print('YES')
		print(x, y)


n = int(input())
s = input().strip()
l = []
for i in range(n - 1):
	if s[i] > s[i + 1]:
		l.append((i, i + 1, s[i:i + 2]))
if len(l) == 0:
	print('NO')
else:
	l1 = l[0][0]
	r = l[0][1]
	st = l[0][2]
	for i in range(1, len(l)):
		if l[i][0] - r <= 1 and st[1] > l[i][2][1]:
			r = l[i][1]
			st = l[i][2]
		else:
			l1 = l[i][0]
			r = l[i][1]
			st = l[i][2]
	print('YES')
	print(l1 + 1, r + 1)


n = int(input())
temp = input()
a = temp[0]
b = 0
ans = False
for i in range(n):
	if a < temp[i]:
		a = temp[i]
	elif a > temp[i]:
		b = i
		ans = True
		break
if ans:
	print('YES')
	print(str(b), str(b + 1))
else:
	print('NO')


from sys import stdin, stdout
from collections import Counter

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

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
n = ip()
s = [i for i in input()]
s2 = sorted(s)
if s2 < s:
	c = 0
	idx = []
	for i in range(n):
		if s[i] != s2[i]:
			idx.append(i + 1)
			for j in range(i + 1, n):
				if s[j] != s2[j] and s[j] == s2[i]:
					idx.append(j + 1)
					c += 1
					break
			if c > 0:
				break
	if len(idx) == 2:
		print('YES')
		print(idx[0], idx[1])
	else:
		print('NO')
else:
	print('NO')


a = int(input())
s = input()
ans = []
for i in range(len(s)):
	ans.append(ord(s[i]) - 97)
if ans == sorted(ans):
	print('NO')
else:
	index = 0
	import math
	maxa = ans[0]
	save = 0
	for i in range(1, len(ans)):
		if ans[i] > maxa:
			maxa = ans[i]
			save = i
		elif ans[i] < maxa:
			print('YES')
			print(save + 1, i + 1)
			exit()


l = int(input())
x = input()
flag = 1
b = [ord(y) for y in x]
for i in range(l - 1):
	if b[i] > b[i + 1]:
		print('YES')
		print(i + 1, i + 2, sep=' ')
		flag = 0
		break
if flag:
	print('NO')


def main():
	l = int(input())
	s = input()
	for index in range(1, len(s)):
		if s[index - 1] > s[index]:
			print('YES')
			print(index, index + 1)
			return
	print('NO')
main()


n = int(input())
s = input()
flag = 0
mx = ord(s[0])
(ind1, ind2) = (1, 0)
for i in range(1, n):
	if ord(s[i]) >= mx:
		ind1 = i + 1
		mx = ord(s[i])
	else:
		ind2 = i + 1
		flag = 1
		break
if flag == 0:
	print('NO')
else:
	print('YES')
	print(ind1, ind2)


class ReverseSubstring:

	def __init__(self, n, s):
		(self.n, self.s) = (n, s)

	def move(self):
		for i in range(self.n - 1):
			if self.s[i] > self.s[i + 1]:
				return (True, (i + 1, i + 2))
		return (False, ())
n = int(input())
s = input().strip()
(check, move) = ReverseSubstring(n, s).move()
if check:
	print('YES')
	print(*move)
else:
	print('NO')


import sys
sys.stdin.readline()
s = sys.stdin.readline().rstrip()
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(f'{i + 1} {i + 2}')
		quit()
print('NO')


n = int(input())
s = input().rstrip()
ss = ''.join(sorted(s))
if s == ss:
	print('NO')
else:
	for j in range(n - 1):
		if s[j] != ss[j]:
			k = s[j + 1:].index(ss[j])
			print('YES\n' + str(j + 1) + ' ' + str(j + 2 + k))
			break


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(input())
b = sorted(a)
ind = -1
for i in range(n):
	if b[i] != a[i]:
		ind = i
		break
if ind == -1:
	print('NO')
else:
	for i in range(ind + 1, n):
		if a[i] == b[ind]:
			ind2 = i
			break
	print('YES')
	print(ind + 1, ind2 + 1)


n = int(input())
s = str(input())
boo = 0
ind = 0
for i in range(n - 1):
	if s[i] > s[i + 1]:
		boo = 1
		ind = i
		break
if boo == 0:
	print('NO')
else:
	print('YES')
	print(str(ind + 1) + ' ' + str(ind + 2))


n = int(input())
s = input()
flag = 0
for (ind, character) in enumerate(s[1:]):
	if s[ind + 1] < s[ind]:
		flag = 1
		print('YES')
		print(ind + 1, ind + 2)
		break
if flag == 0:
	print('NO')


n = input()
n = int(n)
s = input()
ans = ''
p = 0
for i in range(n - 1):
	if ord(s[i]) <= ord(s[i + 1]):
		ans = 'NO'
	else:
		ans = 'YES'
		p = i
		break
q = 0
if ans == 'NO':
	print('NO')
else:
	for j in range(p + 1, n):
		if ord(s[j]) < ord(s[p]):
			q = j
			break
	print('YES')
	print(p + 1, q + 1)


n = int(input())
l = list(input())
if l == sorted(l):
	print('NO')
else:
	print('YES')
	for i in range(n - 1):
		if l[i] > l[i + 1]:
			print(i + 1, i + 2)
			break


(n, a) = (int(input()), input())
for i in range(n - 1):
	if a[i] > a[i + 1]:
		print('YES', i + 1, i + 2)
		break
else:
	print('NO')


n = int(input())
s = input()
flag = True
(l, r) = (-1, -1)
for i in range(0, len(s) - 1):
	if s[i] > s[i + 1]:
		(l, r) = (i, i + 1)
		flag = False
		break
print('YES') if not flag else print('NO')
if l != -1:
	print(l + 1, r + 1)


n = int(input())
s = input()
ans = False
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		ans = True
		a = i
		b = i + 1
		break
if ans:
	print('YES')
	print(a + 1, b + 1)
else:
	print('NO')


num = int(input())
string = str(input())
j = 0
for i in range(num - 1):
	if string[i] > string[i + 1]:
		print('YES')
		j = 1
		print(i + 1, i + 2)
		break
if j == 0:
	print('NO')


input()
word1 = input()

def str_reverse(word):
	idxed_word = [(letter, idx) for (idx, letter) in enumerate(word)]
	idxed_word.sort(key=lambda x: x[0])
	for (idx, letter) in enumerate(word):
		second_letter = idxed_word[idx][0]
		second_idx = idxed_word[idx][1]
		if letter > second_letter:
			print('YES')
			print(idx + 1, second_idx + 1)
			return
	print('NO')
str_reverse(word1)


n = int(input())
str1 = input()
count = 0
for i in range(len(str1) - 1):
	if ord(str1[i]) <= ord(str1[i + 1]):
		count = count + 1
	else:
		a = i
		b = i + 1
if count == n - 1:
	print('NO')
else:
	print('YES')
	print(a + 1, b + 1, end=' ')


n = int(input())
s = input()
for j in range(n - 1):
	if s[j] > s[j + 1]:
		print('YES')
		print(j + 1, j + 2)
		break
else:
	print('NO')


from math import *
n = int(input())
s = input()
l = []
l_ = []
for i in s:
	l.append(i)
	l_.append(i)
l = sorted(l)
if l == l_:
	print('NO')
	exit()
for i in range(1, n):
	if l_[i] < l_[i - 1]:
		print('YES')
		print(i, i + 1)
		exit()


a = []
lenth = int(input())
s = input()
for i in s:
	a.append(i)
(num1, num2) = (-1, -1)
i = 0
while a[i] <= a[i + 1]:
	i += 1
	if i == lenth - 1:
		break
else:
	num1 = i + 1
	num2 = i + 2
if num1 != -1:
	print('yes')
	print(num1, num2)
else:
	print('no')


def solve():
	N = int(input())
	S = list(map(ord, input()))
	pre = 0
	ans = [0, 0]
	for (i, c) in enumerate(S):
		if pre < c:
			pre = c
			ans[0] = i + 1
		elif pre > c:
			ans[1] = i + 1
			print('YES')
			print(*ans)
			return
	print('NO')
solve()


n = int(input())
s = input()
l = [i for i in s]
l.sort()
poss = 0
left = 0
right = 0
for i in range(n):
	if l[i] == s[i]:
		continue
	poss = 1
	left = i + 1
	for j in range(i + 1, n):
		if s[j] == l[i]:
			right = j + 1
	break
if poss:
	print('YES')
	print(left, right)
else:
	print('NO')


inp = lambda cast=int: list(map(cast, input().split()))
(n,) = inp()
(s,) = inp(str)
for i in range(0, n - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


N = int(input())
line = input()
check = False
for i in range(1, len(line)):
	if line[i - 1] > line[i]:
		check = True
		break
if check:
	print('YES')
	print(i, i + 1)
else:
	print('NO')


n = int(input())
s = list(input())
flag = True
for i in range(1, len(s)):
	if s[i - 1] > s[i]:
		flag = False
		print('YES')
		print(i, i + 1)
		break
if flag:
	print('NO')


N = int(input())
S = input()

def stoi(s):
	return ord(s) - 97
for i in range(N - 1):
	if stoi(S[i]) > stoi(S[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


n = int(input())
s = input().strip()
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit(0)
print('NO')


n = int(input())
S = input()
a = ord('a')
pre = -1
prei = -1
for i in range(n):
	if pre > ord(S[i]) - a:
		print('YES')
		print(prei + 1, i + 1)
		exit()
	elif pre <= ord(S[i]) - a:
		pre = ord(S[i]) - a
		prei = i
print('NO')


n = int(input())
s = input()
highest = 'a'
highest_index = -1
for i in range(n):
	if s[i] < highest:
		print('YES')
		print(highest_index + 1, i + 1)
		break
	else:
		highest = s[i]
		highest_index = i
if highest_index == len(s) - 1:
	print('NO')


N = int(input())
s = input()
for i in range(N - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


n = int(input())
a = input()
c = 0
for i in range(n - 1):
	if a[i + 1] < a[i]:
		c = 1
		print('YES')
		print(i + 1, i + 2)
		break
if c == 0:
	print('NO')


n = int(input())
s = input()
prev = ''
T = True
for i in range(1, len(s)):
	if ord(s[i]) < ord(s[i - 1]):
		print('YES')
		print(i, i + 1)
		T = False
		break
if T:
	print('NO')


try:
	l = int(input())
	s = input()
	c = 0
	for i in range(0, l - 1):
		if s[i + 1] < s[i]:
			a = i
			b = i + 1
			c = 1
			break
	if c == 1:
		print('YES')
		print(a + 1, b + 1, end='')
	else:
		print('NO')
except:
	pass


n = int(input())
s = input()
l1 = []
for i in range(n):
	l1.append((s[i], i))
l1.sort()
flag = 0
for i in range(0, n):
	if l1[i][1] != i:
		flag = 1
		f = i
		break
if flag == 0:
	print('NO')
else:
	print('YES')
	print(f + 1, l1[f][1] + 1)


n = int(input())
s = input()
max_read = 'a'
max_ind = 0
f = -1
for i in range(n):
	if s[i] < max_read:
		f = i
		break
	if s[i] > max_read:
		max_read = s[i]
		max_ind = i
if f == -1:
	print('NO')
else:
	print('YES')
	print(max_ind + 1, f + 1)


n = int(input())
string = input()
curr = string[0]
flag = True
for i in range(1, n):
	if string[i] < curr:
		flag = False
		print('YES')
		print(i, i + 1)
		break
	else:
		curr = string[i]
if flag:
	print('NO')


def sv():
	N = int(input())
	S = input()
	bi = 0
	for i in range(1, len(S)):
		if S[i] < S[bi]:
			print('YES')
			print('%d %d' % (bi + 1, i + 1))
			return
		if S[i] > S[bi]:
			bi = i
	print('NO')
sv()


p = input()
inp = [i for i in input()]
for i in range(len(inp) - 1):
	if inp[i] > inp[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


n = int(input())
s = list(input())
flag = False
ans = 0
for i in range(n - 1):
	if s[i] <= s[i + 1]:
		pass
	else:
		(s[i], s[i + 1]) = (s[i + 1], s[i])
		ans = [i + 1, i + 2]
		flag = True
		break
if flag:
	print('YES')
	print(ans[0], ans[1])
else:
	print('NO')


n = int(input())
p = input().rstrip()
x = list(p)
F = 0
V = -1
W = -1
for i in range(0, len(x) - 1):
	if x[i] <= x[i + 1]:
		F += 1
	else:
		V = i
		W = i + 1
		break
if F == n - 1:
	print('NO')
elif len(list(set(x))) == 1:
	print('NO')
else:
	print('YES')
	l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	print(V + 1, W + 1)


def is_lexicographically_less(s, y):
	for i in range(1, len(s)):
		if s[i] < s[i - 1]:
			print('YES')
			print(str(i) + ' ' + str(i + 1))
			return
	print('NO')
a = int(input())
x = str(input())
is_lexicographically_less(x, a)


length = input()
entry_list = list(input())
sorted_entry_list = entry_list.copy()
sorted_entry_list.sort()
if sorted_entry_list == entry_list:
	print('NO')
else:
	position = 0
	while 1 == 1:
		if sorted_entry_list[position] == entry_list[position]:
			position += 1
		else:
			break
	n = position + 1
	solution_found = 'NO'
	while 1 == 1:
		if entry_list[n] < entry_list[position]:
			print('YES')
			print(position + 1, n + 1)
			break
		else:
			n += 1


n = int(input())
l = input()
for i in range(n - 1):
	if l[i] > l[i + 1]:
		n = 0
		print('YES')
		print(i + 1, i + 2)
		break
if n != 0:
	print('NO')


n = int(input())
s = input()
s = list(s)
for i in range(1, len(s)):
	if s[i] < s[i - 1]:
		print('YES')
		print(i, i + 1)
		exit(0)
print('NO')


n = int(input().strip())
s = input().strip()
i = 0
hasSol = False
a = 0
b = 0
while i < n - 1 and (not hasSol):
	if s[i] > s[i + 1]:
		hasSol = True
		a = i + 1
		b = i + 2
	else:
		i += 1
if hasSol:
	print('YES')
	print(a, b)
else:
	print('NO')


n = int(input())
s = input().split()
m = ''.join((lambda x: (x.sort(), x)[1])(list(s)))
q = 0
for i in range(0, n - 1):
	if ord(m[i]) > ord(m[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		q = 1
		break
if q == 0:
	print('NO')


import sys
input = sys.stdin.readline
N = int(input())
S = input().strip()
for i in range(1, N):
	if ord(S[i - 1]) <= ord(S[i]):
		continue
	else:
		print('YES')
		print(i, i + 1)
		return
print('NO')


n = int(input())
s = input()
if sorted(s) == list(s):
	print('NO')
else:
	mx = s[0]
	cur = 0
	till = 0
	for i in range(1, n):
		if s[i] < mx:
			till = i
			break
		elif s[i] > mx:
			mx = s[i]
			cur = i
	print('YES')
	print(cur + 1, till + 1)


from sys import stdin, stdout
import math
from copy import deepcopy
from collections import defaultdict
import heapq
n = int(stdin.readline().strip())
string = list(stdin.readline().strip())
for i in range(1, len(string)):
	if string[i - 1] <= string[i]:
		continue
	else:
		(string[i - 1], string[i]) = (string[i], string[i - 1])
		print('YES')
		print(i, i + 1)
		break
else:
	print('NO')


n = int(input())
s = input()
m = ord(s[0])
r1 = 0
r2 = -1
for i in range(1, n):
	if ord(s[i]) > m:
		r1 = i
		m = ord(s[i])
	elif ord(s[i]) < m:
		r2 = i
		break
if r2 != -1:
	print('YES')
	print(r1 + 1, r2 + 1)
else:
	print('NO')


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
import random
import re
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return map(int, sys.stdin.readline().strip().split(x))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
		if meh < 0:
			meh = 0
	return msf

def res(ans, t):
	print('Case #{}: {}'.format(t, ans))
n = int(input())
s = input()
for i in range(1, n):
	if s[i] < s[i - 1]:
		print('YES')
		print(i, i + 1)
		exit(0)
print('NO')


n = int(input())
s = input()
a = ''.join(sorted(s))
if s == a:
	print('NO')
	exit()
ch = None
idx = 0
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


n = int(input())
a = input()
mx = a[0]
mx_i = 1
for i in range(n):
	if a[i] < mx:
		print('YES')
		print(mx_i, i + 1)
		exit(0)
	else:
		mx_i = i + 1
		mx = a[i]
print('NO')


n = int(input())
s = input()
f = 0
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		f = 1
		print('YES')
		print(i + 1, i + 2)
		break
if f == 0:
	print('NO')


n = int(input())
s = input()
ind = 0
kk = ''
k = 'NO'
for i in range(0, len(s) - 1):
	if s[i] > s[i + 1]:
		kk += s[:i] + s[i:i + 2][::-1] + s[i + 2:]
		k = 'YES'
		ind = i + 1
		break
if k == 'YES':
	print(k)
	print(str(ind) + ' ' + str(ind + 1))
else:
	print(k)


input()
s = input()

def func(s):
	for i in range(len(s) - 1):
		if s[i + 1] < s[i]:
			return (i + 1, i + 2)
	return None
res = func(s)
if res is not None:
	print('YES')
	print('%i %i' % res)
else:
	print('NO')


n = int(input())
s = input()
for i in range(n):
	if i + 1 == n:
		break
	a = s[i:i + 2]
	b = s[i + 1] + s[i]
	if b < a:
		print('YES')
		print(i + 1, i + 2)
		exit(0)
print('NO')


n = int(input())
a = str(input())
c = ord(a[0])
for i in range(1, n):
	if c <= ord(a[i]):
		c = ord(a[i])
	else:
		print('YES')
		print(i, i + 1)
		exit()
print('NO')


n = int(input())
s = input()
k = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		k = i
		break
if k == -1:
	print('NO')
else:
	print('YES')
	print(k + 1, k + 2)


import math
import os
import random
import re
import sys
from operator import itemgetter, attrgetter
(n, s) = (int(input()), input())
res = ()
for i in range(1, n):
	if ord(s[i]) < ord(s[i - 1]):
		res = (i, i + 1)
		break
print('YES \n{0} {1}'.format(res[0], res[1]) if len(res) > 0 else 'NO')


a = input()
b = input()
a = int(a)
b = str(b)
yes = 0
for i in range(a - 1):
	if ord(b[i]) > ord(b[i + 1]):
		yes = 1
		mem = i
if yes == 1:
	print('YES')
	print(mem + 1, mem + 2)
else:
	print('NO')


n = int(input())
s = input()
alph = 'abcdefghijklmnopqrstuvwxyz'
d = dict(zip(list(alph), list(range(26))))
for i in range(1, n):
	if d[s[i]] < d[s[i - 1]]:
		print('YES')
		print(i, i + 1)
		break
else:
	print('NO')


def islowpossible(s):
	n = len(s)
	for i in range(0, n - 1):
		if s[i + 1] < s[i]:
			print('YES')
			return str(i + 1) + ' ' + str(i + 2)
	return 'NO'
n = int(input())
s = str(input())
print(islowpossible(s))


import sys
sys_input = sys.stdin.readline

def si():
	return sys_input().rstrip()

def ii():
	return int(si())

def sti():
	return si().split()

def iti():
	return map(int, sti())

def sli():
	return list(si())

def ili():
	return list(iti())

def main():
	for i in range(N - 1):
		if S[i] > S[i + 1]:
			print('YES')
			print(i + 1, i + 2)
			return
	print('NO')
	return
N = ii()
S = si()
main()


n = int(input())
s = input()
t = 0
for i in range(1, len(s)):
	if s[i] < s[i - 1]:
		t = 1
		print('YES')
		print(i, i + 1)
		break
if t == 0:
	print('NO')


n = int(input())
string = list(input())
x = []
for i in string:
	x.append(i)
string.sort()
if string == x:
	print('NO')
else:
	print('YES')
	index1 = 0
	index2 = 0
	for i in range(n - 1):
		if x[i] > x[i + 1]:
			index1 = i + 1
			index2 = i + 2
			break
	print(index1, index2)


n = int(input())
s = input()
for i in range(1, n):
	if ord(s[i]) < ord(s[i - 1]):
		print('YES')
		print(i, i + 1)
		exit(0)
print('NO')


n = int(input())
s = input()
af = 'NO'
l = -1
r = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		af = 'YES'
		l = i + 1
		r = i + 2
		break
if af == 'YES':
	print(af)
	print(l, r)
else:
	print(af)


n = int(input())
row = list(input())
res = 'NO'
l = 0
for i in range(n - 1):
	if row[i] > row[i + 1]:
		l = i
		res = 'YES'
		break
print(res)
if res == 'YES':
	print(l + 1, l + 2)


n = int(input())
s = str(input())
lis = []
for i in range(n):
	lis.append(s[i])
lis.sort()
fix = ''.join(lis)
if s == fix:
	print('NO')
else:
	print('YES')
	for i in range(n):
		if s[i] != fix[i]:
			print(i + 1, end=' ')
			for j in range(i + 1, n):
				if s[j] == fix[i]:
					print(j + 1)
					break
			break


import sys
input()
s = list(input())
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		sys.exit()
print('NO')


n = int(input())
string = input()
flag = False
for i in range(n - 1):
	if string[i] > string[i + 1]:
		index = [i + 1, i + 2]
		flag = True
		break
if not flag:
	print('NO')
else:
	print('YES')
	print(*index)


def __starting_point():
	n = int(input())
	s = str(input())
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			print('YES')
			print(i + 1, i + 2)
			quit()
	print('NO')
__starting_point()


def main():
	n = int(input())
	s = input()
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			print('YES')
			print(i + 1, i + 2)
			return
	print('NO')
main()


n = int(input())
a = input()
i = 0
for j in range(n):
	if a[j] < a[i]:
		print('YES')
		print(i + 1, j + 1)
		break
	if a[j] > a[i]:
		i = j
else:
	print('NO')


n = int(input())
m = input()
for i in range(len(m) - 1):
	if m[i] > m[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


import sys
import math
import bisect
import itertools
import random

def main():
	n = int(input())
	s = input()
	A = []
	for i in range(n):
		A.append(ord(s[i]) - ord('a'))
	d = dict()
	ans = None
	for i in range(n):
		for t in range(A[i] + 1, 27):
			if t in d:
				ans = [d[t], i]
				break
		if ans != None:
			break
		d[A[i]] = i
	if ans == None:
		print('NO')
	else:
		print('YES')
		print('%d %d' % (ans[0] + 1, ans[1] + 1))
main()


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

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 get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
n = int(input())
inputstring = list(map(str, input()))
sortedstring = sorted(inputstring)
if sortedstring == inputstring:
	print('NO')
else:
	print('YES')
	for i in range(n - 1):
		if inputstring[i] > inputstring[i + 1]:
			print(i + 1, i + 2)
			break


import sys
input = sys.stdin.readline

def ii():
	return int(input())

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

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

def li():
	return list(input().rstrip())
N = ii()
S = li()
sortS = sorted(S)
if S == sortS:
	print('NO')
else:
	print('YES')
	for i in range(N):
		if S[i] != sortS[i]:
			for j in range(i + 1, N):
				if S[j] < S[i]:
					print(i + 1, j + 1)
					exit()


n = int(input())
st = input()
for i in range(n - 1):
	if st[i] > st[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit()
else:
	print('NO')


inp = lambda : int(input())
strl = lambda : list(input().strip())
seq = lambda : list(map(int, input().strip().split()))

def f(arr, n):
	for i in range(1, n):
		if arr[i] < arr[i - 1]:
			return ['YES', [i, i + 1]]
	return ['NO']

def main():
	n = inp()
	a = input()
	result = f(a, n)
	print(result[0])
	if len(result) > 1:
		print(*result[1])
main()


n = int(input())
a = input()
(lo, hi) = (0, 0)
flag = 0
for i in range(n - 1):
	x = a[i]
	y = a[i + 1]
	if x > y:
		flag = 1
		lo = i + 1
		hi = i + 2
		break
if flag == 1:
	print('YES')
	print(lo, hi)
else:
	print('NO')


a = input()
s = input()
r = 0
flag = 0
for i in range(len(s)):
	if i == 0:
		r = ord(s[i])
	elif ord(s[i]) >= r:
		r = ord(s[i])
		continue
	else:
		print('YES')
		print(i, i + 1)
		flag = 1
		break
if flag == 0:
	print('NO')


n = int(input())
t = input()
flag = 0
for i in range(n - 1):
	if ord(t[i]) > ord(t[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		flag = 1
		break
	else:
		continue
if flag == 0:
	print('NO')


n = int(input())
s = input()
mx = -1
for i in range(n):
	if ord(s[i]) < mx:
		print('YES')
		print(ind, i + 1)
		break
	elif ord(s[i]) > mx:
		mx = ord(s[i])
		ind = i + 1
else:
	print('NO')


import sys
input = sys.stdin.readline
n = int(input())
s = input().strip()
biggest = ord(s[0])
ind = 0
for i in range(1, n):
	if ord(s[i]) < biggest:
		print('YES')
		print(ind + 1, i + 1)
		sys.exit(0)
	else:
		biggest = ord(s[i])
		ind = i
print('NO')


t = int(input())
s = input()
a = []
for i in range(len(s)):
	a.append(ord(s[i]) - 97)
maxi = 0
flag = -1
for i in range(len(a)):
	if a[i] >= a[maxi]:
		maxi = i
	else:
		flag = i
		break
if flag == -1:
	print('NO')
else:
	print('YES\n')
	print(maxi + 1, ' ', flag + 1)


n = int(input())
a = input()
for i in range(1, n):
	if a[i] < a[i - 1]:
		print('YES')
		exit(print(i, i + 1))
print('NO')


import math
import sys
t = 1
for _ in range(t):
	n = int(sys.stdin.readline())
	s = list(input())
	a = s.copy()
	a.sort()
	if a == s:
		print('NO')
	else:
		k = []
		print('YES')
		for i in range(n - 1):
			if ord(s[i]) > ord(s[i + 1]):
				k.append([i, i + 1])
				break
		print(k[0][0] + 1, k[0][1] + 1)


n = int(input())
s = list(input())
ruined = 0
table = []
for i in range(n - 1):
	if s[i] > s[i + 1]:
		ruined = 1
		table = [i + 1, i + 2]
if not ruined:
	print('NO')
else:
	print('YES')
	print(*table)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	s = input().strip()
	m = s[-1]
	at = n - 1
	for i in range(n - 2, -1, -1):
		if s[i] > m:
			print('YES')
			print(i + 1, at + 1)
			return
		m = s[i]
		at = i
	print('NO')
main()


n = int(input())
s = input()
cur = s[0]
idx = 0
pos = 0
for i in range(1, n):
	if ord(s[i]) < ord(cur):
		pos = 1
		l = idx + 1
		r = i + 1
		break
	else:
		idx = i
		cur = s[i]
if pos == 0:
	print('NO')
else:
	print('YES')
	print('{} {}'.format(l, r))


n = int(input())
s = input()
first = [300000500] * 26
last = [-1] * 26
for i in range(n):
	val = ord(s[i]) - ord('a')
	first[val] = min(first[val], i)
	last[val] = max(last[val], i)
for i in range(25, -1, -1):
	for j in range(i - 1, -1, -1):
		if first[i] < last[j]:
			print('YES\n', first[i] + 1, last[j] + 1)
			exit(0)
print('NO')


N = int(input())
S = input()
ok = False
for i in range(N - 1):
	if S[i] > S[i + 1]:
		ok = True
		print('YES')
		print(i + 1, i + 2)
		break
if not ok:
	print('NO')


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(input())
	for i in range(1, n):
		if a[i] < a[i - 1]:
			print('YES')
			print(i, i + 1)
			exit(0)
	else:
		print('NO')
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')
main()


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def modu(a, m):
	if a % m:
		return a % m
	return m

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

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

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s
n = int(input())
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


import string
n = int(input())
s = input()
d = dict()
ss = string.ascii_lowercase
for (i, j) in enumerate(s):
	d[j] = i
flag = False
for (i, j) in enumerate(s):
	for k in ss:
		if k == j:
			break
		if d.get(k, None) is not None:
			if d[k] > i:
				print('YES')
				print(i + 1, d[k] + 1)
				flag = True
				break
	if flag:
		break
if flag == False:
	print('NO')


def go():
	n = int(input())
	a = [ord(i) for i in input()]
	for i in range(1, n):
		if a[i] < a[i - 1]:
			output = 'YES\n'
			output += '{} {}'.format(i, i + 1)
			return output
	return 'NO'
print(go())


input()
s = input()
srt = ''.join(sorted(s))
if s == srt:
	print('NO')
else:
	print('YES')
	first = 0
	second = 0
	symbol = 0
	for (i, (a, b)) in enumerate(zip(s, srt)):
		if a != b:
			first = i
			symbol = b
			break
	for i in range(first, len(s)):
		if s[i] == b:
			second = i
	print(' '.join(map(str, (first + 1, second + 1))))


import sys
n = int(input())
s = list(input())
for (i, c) in enumerate(s):
	if i > 0:
		if s[i - 1] > s[i]:
			print('YES')
			print(i, i + 1)
			sys.exit(0)
print('NO')


l = int(input())
s = input()
n = ''.join(sorted(s))
if s == n:
	print('NO')
else:
	print('YES')
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			break
	print(i + 1, i + 2)


input()
a = input()
b = ''.join(sorted(a))
if a == b:
	print('NO')
else:
	print('YES')
	for i in range(len(a) - 1):
		if ord(a[i]) > ord(a[i + 1]):
			f = i
			break
	print(f + 1, f + 2)


def main():
	n = int(input())
	s = input()
	l = -1
	r = -1
	for i in range(n - 1):
		if ord(s[i + 1]) < ord(s[i]):
			l = i + 1
			r = i + 2
			break
	if l != -1 and r != -1:
		print('YES')
		print(l, r)
	else:
		print('NO')
main()


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
n = int(input())
s = list(input()[:-1])
x = dc(list)
if len(set(s)) == 1:
	print('NO')
else:
	for i in range(n):
		x[s[i]].append(i)
	p = 'abcdefghijklmnopqrstuvwxyz'
	f = 0
	k = -1
	for i in range(n):
		for j in range(ord(s[i]) - ord('a')):
			if x[p[j]]:
				k = bisect_left(x[p[j]], i)
				if k != len(x[p[j]]):
					k = x[p[j]][k]
					f = 1
					break
			if f == 1:
				break
		if f == 1:
			break
	if f == 0:
		print('NO')
	else:
		print('YES')
		print(i + 1, k + 1)


n = int(input())
s = input()
ok = 0
idx = (0, 0)
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		ok = 1
		idx = (i + 1, i + 2)
		break
if ok:
	print('YES')
	print(*idx)
else:
	print('NO')


def substring(s):
	for i in range(len(s)):
		if i + 1 < len(s) and s[i + 1] < s[i]:
			return ['YES', [i + 1, i + 2]]
	return ['NO']
n = int(input())
t = input()
if len(substring(t)) == 2:
	print(substring(t)[0])
	print(*substring(t)[1])
else:
	print(*substring(t))


n = int(input())
s = input()
if list(s) == sorted(s):
	print('NO')
else:
	i = 0
	while s[i] <= s[i + 1]:
		i += 1
	print('YES')
	print(i + 1, i + 2)


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
N = int(input())
S = input()[:-1]
prev = S[0]
ans = 'NO'
for (i, c) in enumerate(S[1:], 1):
	if prev <= c:
		prev = c
		continue
	else:
		print('YES')
		print(i, i + 1)
		exit()
print(ans)


n = int(input())
u = list(input())
u1 = sorted(u)
if u == u1:
	print('NO')
else:
	print('YES')
	a = 0
	b = 0
	for i in range(n):
		if ord(u[i]) > ord(u1[i]):
			a = i
			break
	for i in range(a + 1, n):
		if ord(u[i]) < ord(u[a]):
			b = i
			break
	print(a + 1, b + 1)


k = int(input())
s = list(map(ord, input()))
n = -1
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		n = i
		break
if n != -1:
	print('YES')
	print(n + 1, n + 2)
else:
	print('NO')


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


n = int(input())
s = list(input())
for i in range(1, len(s)):
	if s[i] < s[i - 1]:
		print('YES')
		print(i, i + 1)
		break
else:
	print('NO')


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
lens = RI()
ins = RW()
valid = False
for i in range(lens - 1):
	if ins[i] > ins[i + 1]:
		print('YES')
		print(*[i + 1, i + 2])
		valid = True
		break
if not valid:
	print('NO')


input()
s = list(input())
ok = True
for k in range(0, len(s) - 1):
	if s[k] > s[k + 1]:
		print('YES')
		print(k + 1, k + 2)
		ok = False
		break
if ok:
	print('NO')


from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(str(i + 1) + ' ' + str(i + 2))
		exit()
print('NO')


n = int(input())
s = input()
count = 0
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		count += 1
		print('YES')
		tup = (i + 1, i + 2)
		print(*tup)
		break
if count == 0:
	print('NO')


n = int(input())
arr = list(input())
ark = arr.copy()
ark.sort()
if ark == arr:
	print('NO')
else:
	print('YES')
	for i in range(n - 1):
		if arr[i] > arr[i + 1]:
			print('{} {}'.format(i + 1, i + 2))
			quit()


n = int(input())
s = str(input())
t = 'NO'
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		t = 'YES'
		break
print(t)
if t == 'YES':
	print(i + 1, ' ', i + 2)


n = list(map(int, input().split()))
s = input()
now = 'a'
f = False
for (idx, i) in enumerate(s):
	if i >= now:
		now = i
		continue
	else:
		f = True
		r = idx
		break
if f:
	print('YES')
	print(str(r) + ' ' + str(r + 1))
else:
	print('NO')


flag = True
n = int(input())
stri = list(map(ord, list(input())))
for i in range(1, n):
	if stri[i - 1] > stri[i]:
		print('YES')
		print(i, i + 1)
		flag = False
		break
if flag:
	print('NO')


n = int(input())
s = input()
ok = False
for i in range(n):
	if i > 0 and s[i - 1] > s[i]:
		ok = True
		ans = i
		break
if ok:
	print('YES')
	print('%d %d' % (ans, ans + 1))
else:
	print('NO')


def main():
	n = int(input())
	s = input()
	try:
		index = next((i for i in range(n - 1) if s[i] > s[i + 1]))
		print('YES\n%d %d' % (index + 1, index + 2))
	except StopIteration:
		print('NO')
main()


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	n = int(input())
	s = input()
	mx = s[0]
	mxi = 0
	for i in range(n):
		if mx < s[i]:
			mx = s[i]
			mxi = i
		if mx > s[i]:
			print('YES')
			print(mxi + 1, i + 1)
			exit(0)
	print('NO')
main()


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


n = int(input())
s = input()
for i in range(n - 1):
	if s[i + 1] < s[i]:
		print('YES')
		print(i + 1, i + 2)
		raise SystemExit
print('NO')


n = int(input())
str = input()
found = False
for i in range(1, n, 1):
	if str[i] < str[i - 1]:
		found = True
		print('YES')
		print(i, ' ', i + 1)
		break
if not found:
	print('NO')


import math
n = int(input())
s = input()
x = ''.join(sorted(s))
if x == s:
	print('NO')
else:
	for i in range(1, n):
		if s[i] < s[i - 1]:
			print('YES')
			print(i, i + 1)
			break


import sys
num = int(input())
word = input()
prev = word[0]
for i in range(1, num):
	if word[i] < prev:
		print('YES')
		print(i, i + 1)
		sys.exit()
	else:
		prev = word[i]
print('NO')


n = int(input())
string = input()
start = -1
end = -1
for i in range(n - 1):
	if ord(string[i]) <= ord(string[i + 1]):
		continue
	else:
		start = i
		for j in range(start + 1, n):
			if ord(string[j]) < ord(string[start]):
				end = j
				break
		break
if start == -1 or end == -1:
	print('NO')
else:
	print('YES')
	print(start + 1, end + 1)


n = int(input())
s = input()
max_char_i = 0
max_char = s[0]
for (i, c) in enumerate(s[1:], 1):
	if c < max_char:
		print('YES')
		print(max_char_i + 1, i + 1)
		exit()
	max_char_i = i
	max_char = c
print('NO')


s = input()
s = input()
exist = False
for x in range(0, len(s) - 1):
	if s[x] > s[x + 1]:
		exist = True
		break
if exist:
	print('YES')
	print('{} {}'.format(x + 1, x + 2))
else:
	print('NO')


n = int(input())
s = input()
g = list(s)
if sorted(g) == g:
	print('NO')
else:
	print('YES')
	b = 'a'
	l = 0
	for i in range(len(s)):
		if s[i] < b:
			print(l, i + 1)
			return
		elif s[i] > b:
			b = s[i]
			l = i + 1


import math

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	b = [int(x) for x in input().split()]
	return (n, m, b)

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
n = int(input())
s = input()
new = ''
a = 0
b = 0
for i in range(n - 1):
	s1 = s[i]
	s2 = s[i + 1]
	if s1 > s2:
		new = s1 + s2
		a = i
		b = i + 1
		print('YES')
		print(a + 1, b + 1)
		exit()
print('NO')


import sys
n = int(input())
s = input()
opt = False
sol = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		opt = True
		sol = i
		break
if opt == True:
	print('YES')
	print(str(i + 1) + ' ' + str(i + 2))
else:
	print('NO')


n = int(input())
data = input()
checker = 0
for i in range(n - 1):
	if ord(data[i]) <= ord(data[i + 1]):
		continue
	else:
		checker += 1
if checker == 0:
	print('NO')
else:
	for i in range(n - 1):
		if ord(data[i]) > ord(data[i + 1]):
			print('YES')
			print(i + 1, i + 2)
			break


n = int(input())
s1 = input()
inp = list(s1)
f = 0
i = 0
while ord(inp[i]) <= ord(inp[i + 1]):
	i += 1
	if i + 1 >= n:
		print('NO')
		f = 1
		break
if f == 0:
	j = i + 1
	while ord(inp[j]) > ord(inp[i]):
		j += 1
	print('YES')
	print(i + 1, j + 1)


input()
s = input()
p = s[0]
i = 1
for e in s[1:]:
	if e > p:
		p = e
	elif e < p:
		print('YES')
		print('{} {}'.format(i, i + 1))
		exit()
	i += 1
print('NO')


N = int(input())
s = input()
for i in range(1, N):
	if s[i] < s[i - 1]:
		print('YES')
		print(i, i + 1)
		quit()
print('NO')


nn = input()
ss = input()
problem = -1
for i in range(0, len(ss)):
	if i == int(nn) - 1:
		break
	if ss[i] <= ss[i + 1]:
		continue
	else:
		problem = i
if problem == -1:
	print('NO')
else:
	print('YES')
	print(problem + 1, problem + 2)


n = int(input())
p = input()
index = 0
s = []
res = []
for i in range(n):
	if s and p[i] > s[-1][0]:
		s.append((p[i], i))
	elif s and p[i] < s[-1][0]:
		res.extend([s[-1][1] + 1, i + 1])
		break
	elif s:
		s.append((p[i], s[-1][1]))
	else:
		s.append((p[i], i))
if not res:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, res)))


n = int(input())
s = input()
tmp = 'a'
ans = -1
for (index, i) in enumerate(s):
	if i >= tmp:
		tmp = i
	else:
		ans = index
		break
if ans == -1:
	print('NO')
else:
	print('YES')
	print('{} {}'.format(ans, ans + 1))


n = int(input())
s = input()
k = 0
x = s[0]
for i in range(1, n):
	if s[i] >= s[i - 1]:
		continue
	else:
		k = 1
		break
if k == 0:
	print('NO')
else:
	print('YES')
	print(i, i + 1)


def main():
	l = int(input())
	s = input()
	smallest = 97
	index = 0
	while index < len(s):
		if ord(s[index]) == smallest:
			index += 1
			continue
		target = s.rfind(chr(smallest), index + 1)
		if target > index:
			print('YES')
			print(index + 1, target + 1)
			return
		else:
			smallest += 1
	print('NO')
main()


(x, p) = (int(input()), input())
for i in range(x - 1):
	if p[i] > p[i + 1]:
		exit(print('YES', i + 1, i + 2))
print('NO')


n = int(input())
s = input()
i = 0
while i < n - 1:
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
	if i == n - 2:
		print('NO')
	i += 1


import sys
sys.setrecursionlimit(int(10000000.0))

def main():
	n = int(input().strip())
	s = input().strip()
	i = min([i for i in range(n - 1) if s[i] > s[i + 1]] + [n])
	if i == n:
		print('NO')
	else:
		print('YES')
		print(i + 1, i + 2)
	return
while 1:
	try:
		main()
	except EOFError:
		break


n = int(input())
s = input().strip()
f = 0
res = ''
for j in range(n - 1):
	if ord(s[j]) > ord(s[j + 1]):
		f = 1
		res = res + str(j + 1) + ' ' + str(j + 2)
		break
if f == 0:
	print('NO')
else:
	print('YES')
	print(res)


n = int(input())
s = list(input())
for i in range(1, n):
	if s[i] < s[i - 1]:
		print('YES')
		print(str(i) + ' ' + str(i + 1))
		exit()
print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

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

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	n = I()
	s = S()
	t = s[0]
	ti = 0
	for i in range(1, n):
		u = s[i]
		if t < u:
			t = u
			ti = i
		elif u < t:
			return 'YES\n{} {}'.format(ti + 1, i + 1)
	return 'NO'
print(main())


(m, a, b) = (0, int(input()), input())
for x in range(1, a):
	if b[x] >= b[m]:
		m = x
	else:
		print('YES')
		print(m + 1, x + 1)
		break
if m == a - 1:
	print('NO')


n = int(input())
s = input()
l = list(s)
s1 = sorted(l)
if l == s1:
	print('NO')
else:
	for i in range(n - 1):
		if l[i] > l[i + 1]:
			le = i + 1
			lr = i + 2
			break
	print('YES')
	print(le, end=' ')
	print(lr)


n = int(input())
s = input()
c = s[0]
possible = False
for k in range(1, n):
	if s[k] < s[k - 1]:
		print('YES')
		print(k, k + 1)
		exit(0)
print('NO')


n = int(input())
s = input()
left = -1
right = -1
for i in range(1, n):
	if s[i - 1] > s[i]:
		left = i - 1
		right = i
		break
if left >= 0 and right >= 0:
	print('YES')
	print(left + 1, right + 1)
else:
	print('NO')


import sys
n = int(input())
string = input()
for i in range(len(string) - 1):
	if ord(string[i + 1]) < ord(string[i]):
		print('YES')
		print(i + 1, i + 2)
		return
print('NO')


n = int(input())
s = input()
maxi = -1
f = False
for i in range(n):
	if maxi != -1 and s[i] < s[maxi]:
		print('YES')
		print(maxi + 1, i + 1)
		f = True
		break
	elif maxi == -1:
		maxi = i
	elif s[i] > s[maxi]:
		maxi = i
if not f:
	print('NO')


n = int(input())
s = list(input())
s2 = sorted(s)
aldict = {}
tmp = 'abcdefghijklmnopqrstuvwxyz'
for (i, c) in enumerate(tmp):
	aldict[c] = i
if s == s2:
	print('No')
else:
	diffs = []
	count = 0
	i = 0
	c1 = None
	loop = True
	while loop:
		if s[i] != s2[i]:
			if count == 0:
				c1 = s[i]
				val1 = aldict[c1]
				count += 1
				diffs.append(i)
		if count == 1 and val1 > aldict[s[i]]:
			diffs.append(i)
			loop = False
		i += 1
	print('Yes')
	print(' '.join([str(diff + 1) for diff in diffs]))


import sys
n = int(input())
s = input()
if s == ''.join(sorted(s)):
	print('NO')
	sys.exit(0)
for i in range(n - 1):
	if s[i + 1] < s[i]:
		print('YES')
		print(i + 1, i + 2)
		break


n = int(input())
s = str(input())
answer = 0
for i in range(1, len(s)):
	if s[i] < s[i - 1]:
		answer = i + 1
if answer:
	print('YES')
	print(answer - 1, answer)
else:
	print('NO')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
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')
n = int(input())
s = input()
ch = 0
for i in range(1, n):
	if ord(s[i]) < ord(s[i - 1]):
		ch = 1
		print('YES')
		print(i, i + 1)
		break
if ch == 0:
	print('NO')


n = int(input())
s = input()
s = [i for i in s]
z = sorted(s)
if z == s:
	print('NO')
else:
	for i in range(n - 1):
		if ord(s[i]) > ord(s[i + 1]):
			print('YES')
			print(i + 1, i + 2)
			break


n = int(input())
string = input()
for i in range(n - 1):
	if string[i] > string[i + 1]:
		print('YES')
		print(i + 1, end=' ')
		print(i + 2)
		exit()
else:
	print('NO')


n = int(input().strip())
string = input().strip()
(first, last) = (0, 0)
has = False
for i in range(1, n):
	if string[i] < string[i - 1]:
		first = i
		last = i + 1
		has = True
		break
if has:
	print('YES')
	print(first, last)
else:
	print('NO')


n = int(input())
l = list(input())
for i in range(n - 1):
	if l[i] > l[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


n = int(input())
s = input()
k = 0
l = []
for i in range(len(s) - 1):
	if s[i] <= s[i + 1]:
		k += 1
	else:
		l.append([i + 1, i + 2])
if k == len(s) - 1:
	print('NO')
else:
	print('YES')
	print(*l[0])


def main():
	n = int(input())
	s = input()
	done = False
	for i in range(n - 1, 0, -1):
		if s[i] < s[i - 1]:
			print('YES')
			print(i, i + 1)
			done = True
			break
	if not done:
		print('NO')
main()


n = int(input())
b = str(input())
ans = -1
s = len(b) - 1
for i in range(s):
	if b[i] > b[i + 1]:
		ans = i
		break
if ans > -1:
	print('YES')
	print(i + 1, i + 2)
else:
	print('NO')


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict

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

def stringListIn():
	return [x for x in stdin.readline().split()]

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

def stringIn():
	return stdin.readline().strip()
n = intIn()
s = stringIn()
flag = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		flag = True
		break
if flag:
	print('YES')
	print(i + 1, i + 2)
else:
	print('NO')


n = int(input())
s = list(str(input()))
ok = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print('Yes')
		print(i + 1, i + 2)
		ok = True
		break
if ok == False:
	print('No')


n = int(input())
s = list(map(ord, list(input())))
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


import sys
if len(sys.argv) > 1:
	if sys.argv[1] == 'LOCAL':
		sys.stdin = open('input.in', 'r')
n = int(input())
s = input()
i = 0
while i < n - 1:
	if ord(s[i]) > ord(s[i + 1]):
		break
	i += 1
if i == n - 1:
	print('NO')
else:
	print('YES')
	print(i + 1, i + 2)


n = int(input())
s = input()

def find_pos(s, n):
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			return i + 1
	return -1
res = find_pos(s, n)
if res == -1:
	print('No')
else:
	print('Yes')
	print(res, res + 1)


n = int(input())
s = input()

def calc(s):
	val = ord(s[-1])
	an = n
	for i in range(n - 1, -1, -1):
		if ord(s[i]) > val:
			return (i + 1, an)
		else:
			val = ord(s[i])
			an = i + 1
	return (-1, -1)
ans = calc(s)
if ans[0] == -1:
	print('NO')
else:
	print('YES')
	print(*ans)


num = input()
s = input()
s_n = [i for i in s]
s_n.sort()
if ''.join(s_n) == s:
	print('NO')
else:
	print('YES')
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			print(i + 1, i + 2)
			break


def solve():
	N = int(input())
	s = input()
	start = 0
	for i in range(1, N):
		if s[i] > s[start]:
			start = i
			continue
		if s[i] < s[start]:
			print('YES')
			print(start + 1, i + 1)
			return
	print('NO')
solve()


n = int(input())
a = list(input())
otv = 'NO'
for i in range(n - 1):
	if a[i] > a[i + 1]:
		otv = 'YES'
		x = i + 1
		y = i + 2
		break
print(otv)
if otv == 'YES':
	print(x, y)


n = int(input())
s = input()
i = 0
while i < n - 1 and s[i] <= s[i + 1]:
	i += 1
if i == n - 1:
	print('NO')
else:
	print('YES')
	print('{} {}'.format(i + 1, i + 2))


n = int(input())
s = list(input().strip())
start = 0
for (ind, sym) in enumerate(s):
	if sym < s[start]:
		print('YES')
		print(start + 1, ind + 1)
		break
	else:
		start = ind
else:
	print('NO')


def nxtSmallest(string, n):
	stack = []
	top = -1
	res = []
	for i in range(n - 1, -1, -1):
		curr = string[i]
		while top >= 0 and string[stack[top]] >= curr:
			stack.pop()
			top -= 1
		if top == -1:
			res.append(-1)
		else:
			res.append(stack[top])
		stack.append(i)
		top += 1
	res.reverse()
	for i in range(n):
		if res[i] != -1:
			return (i + 1, res[i] + 1)
	return None
n = int(input())
string = input()
res = nxtSmallest(string, n)
if res == None:
	print('NO')
else:
	print('YES')
	print(*res)


n = int(input())
string = input()
cur_max = 0
max_idx = -1
for i in range(n):
	if ord(string[i]) < cur_max:
		print('YES')
		print(max_idx + 1, i + 1)
		exit()
	if ord(string[i]) > cur_max:
		(cur_max, max_idx) = (ord(string[i]), i)
print('NO')


n = int(input())
s = input()
ans = None
for i in range(n - 1):
	if s[i] > s[i + 1]:
		ans = (i + 1, i + 2)
		break
if ans:
	print('YES')
	print(*ans)
else:
	print('NO')


input()
s = input()
a = 0
b = 0
for i in range(0, len(s) - 1):
	if s[i] > s[i + 1]:
		a = i
		b = i + 1
		break
if b:
	print('YES')
	print(a + 1, b + 1)
else:
	print('NO')


for _ in range(1):
	n = int(input())
	s = input()
	ch = -1
	for i in range(1, n):
		if s[i] < s[i - 1]:
			print('YES')
			print(i, i + 1)
			ch = 1
			break
	if ch == -1:
		print('NO')


n = int(input())
s = list(map(ord, list(input())))
flag = 0
for i in range(n - 1):
	if s[i + 1] >= s[i]:
		continue
	else:
		flag = 1
		ans = [i + 1, i + 2]
		break
if flag == 0:
	print('NO')
else:
	print('YES')
	print(ans[0], ans[1])


n = int(input())
s = input()
poses = [-1] * 30
poses[ord(s[0]) - ord('a')] = 0
good = True
for i in range(1, len(s)):
	for j in range(ord(s[i]) - ord('a') + 1, 30):
		if poses[j] > -1:
			print('YES')
			print(poses[j] + 1, i + 1)
			good = False
			break
	poses[ord(s[i]) - ord('a')] = i
	if not good:
		break
if good:
	print('NO')


N = int(input().strip())
S = str(input().strip())
st = False
for idx in range(N - 1):
	if ord(S[idx]) > ord(S[idx + 1]):
		print('YES')
		print(idx + 1, idx + 2)
		st = True
		break
if st == False:
	print('NO')


from sys import stdin, stdout
n = int(input())
s = stdin.readline()
pret = s[0:1]
i = 1
b = False
for c in s:
	if i > 1 and c < pret and (i <= n):
		print('YES')
		print(i - 1, i)
		b = True
		break
	i += 1
	pret = c
if b == False:
	print('NO')


__version__ = '0.1'
__date__ = '2019-04-23'
import sys
import string

def solve(n, s):
	for i in range(1, n):
		if s[i] < s[i - 1]:
			return i
	return -1

def main(argv=None):
	n = int(input())
	s = input()
	answer = solve(n, s)
	if answer >= 0:
		print('YES')
		print(answer, answer + 1)
	else:
		print('NO')
	return 0
STATUS = main()
sys.exit(STATUS)


n = int(input())
a = list(input())
b = []
ans = 0
t1 = 0
t2 = 0
for i in range(n - 1):
	if a[i] > a[i + 1]:
		b.append(a[i])
		b.append(a[i + 1])
		ans = 1
		t1 = i + 1
		t2 = i + 2
		break
if ans == 0:
	print('NO')
else:
	print('YES')
	print(t1, t2)


n = int(input())
s = input()
st = ''.join(sorted(s))
if st == s:
	print('NO')
else:
	begin = 0
	end = 0
	for i in range(n):
		if s[i] > st[i]:
			begin = i + 1
		elif begin != 0 and s[i] < s[begin - 1]:
			end = i + 1
			break
	print('YES')
	print(begin, end)


n = int(input())
s = str(input())
X = [[] for i in range(26)]
for (i, c) in enumerate(s):
	j = ord(c) - ord('a')
	if j != 25:
		for k in range(j + 1, 26):
			if len(X[k]) == 0:
				continue
			else:
				print('YES')
				print(X[k][0] + 1, i + 1)
				exit()
	X[j].append(i)
print('NO')


r = int(input())
string1 = input()
for i in range(len(string1) - 1):
	if string1[i] > string1[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
for _ in range(T):
	n = int(stdin.readline())
	s = list(stdin.readline().strip('\n'))
	isOk = False
	for i in range(1, n):
		if s[i] < s[i - 1]:
			isOk = True
			break
	if isOk:
		print('YES')
		print(i, i + 1)
	else:
		print('NO')


n = int(input())
a = input()
flag = 0
for i in range(n - 1):
	if ord(a[i]) > ord(a[i + 1]):
		flag = 1
		print('YES')
		print(i + 1, i + 2)
		break
if flag == 0:
	print('NO')


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n
primes = []

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	else:
		return int(input())
n = f()
s = input()
for i in range(n - 1):
	if s[i + 1] < s[i]:
		print('YES')
		print(i + 1, i + 2)
		exit()
print('NO')


length = input()
s = input()
out = -1
for k in range(1, len(s)):
	if s[k] < s[k - 1]:
		out = k
		break
if out == -1:
	print('NO')
else:
	print('YES')
	print(str(k) + ' ' + str(k + 1))


n = int(input())
s = input()

def solve():
	seen = [-1] * 26
	for i in range(n):
		cur = s[i]
		seen[ord(cur) - ord('a')] = i
		for j in range(ord(cur) - ord('a') + 1, 26):
			if seen[j] != -1:
				print('YES')
				print(seen[j] + 1, i + 1)
				return
	print('NO')
solve()


from sys import exit
length = int(input())
string = list(input())
for i in range(length - 1):
	if ord(string[i]) > ord(string[i + 1]):
		print('YES')
		print(str(i + 1) + ' ' + str(i + 2))
		exit()
print('NO')


import sys, math
from collections import defaultdict
n = int(input())
s = input()
maxchr = 'a'
maxindex = -1
ans = 'NO'
for i in range(n):
	if s[i] > maxchr:
		maxchr = s[i]
		maxindex = i
	elif s[i] < maxchr:
		print('YES')
		print(maxindex + 1, i + 1)
		ans = 'YES'
		break
if ans == 'NO':
	print('NO')


a = input()
a = int(a)
str = input()
for i in range(a - 1):
	if ord(str[i]) > ord(str[i + 1]):
		print('Yes')
		print(i + 1, i + 2)
		break
else:
	print('No')


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

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

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

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mm = 1000000007
yp = 0

def solve():
	t = 1
	for tt in range(t):
		n = nu()
		s = input()
		xp = [0] * 26
		for i in range(26):
			xp[i] = []
		fl = False
		for i in range(n - 1, -1, -1):
			hh = ord(s[i]) - 97
			for j in range(hh):
				if len(xp[j]) != 0:
					fl = True
					print('YES')
					print(i + 1, xp[j][0] + 1)
					return
			xp[hh].append(i)
		if fl == False:
			print('NO')
solve()


n = int(input())
s = input().strip()
for idx in range(1, len(s)):
	if ord(s[idx]) >= ord(s[idx - 1]):
		pass
	else:
		print('YES')
		print('{} {}'.format(idx, idx + 1))
		exit(0)
print('NO')


n = int(input())
S = input()
last = 0
for i in range(1, n):
	if S[i] < S[last]:
		print('YES')
		print(last + 1, i + 1)
		break
	last = i
else:
	print('NO')


n = int(input())
s = input()
x = 1
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


n = int(input())
s = input()
a = []
b = []
x = 'a'
has_ans = 0
for i in range(0, 26):
	a.append(s.rfind(x))
	b.append(s.find(x))
	x = chr(ord(x) + 1)
for x in range(0, 26):
	if a[x] == -1:
		continue
	for y in range(25, x, -1):
		if b[y] == -1:
			continue
		if a[x] > b[y]:
			print('YES')
			print(b[y] + 1, a[x] + 1)
			has_ans = 1
			break
	if has_ans == 1:
		break
if has_ans == 0:
	print('NO')


n = int(input())
s = input()
ss = sorted(s)
if ''.join(sorted(s)) == s:
	print('NO')
	exit()
(i, j) = (0, 0)
for k in range(len(s)):
	if s[k] != ss[k]:
		i = k
		break
for k in range(i, len(s)):
	if s[k] < s[i]:
		j = k
		break
print('YES')
print(i + 1, j + 1)


n = int(input())
s = input()
t = ''.join(sorted(s))
if t == s:
	print('NO')
else:
	cur = 0
	for i in range(1, n):
		if s[i] < s[cur]:
			print('YES')
			print(cur + 1, i + 1)
			break
		else:
			cur = i


from sys import *
from math import *
N = int(input())
S = input()
f = -1
for i in range(1, N):
	if S[i] < S[i - 1]:
		f = i
		break
if f == -1:
	print('NO')
else:
	print('YES')
	print(i, end=' ')
	print(i + 1)


input()
s = input()
fl = True
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		fl = False
		break
if fl:
	print('NO')


n = int(input())
s = input()
for i in range(1, n):
	if s[i] < s[i - 1]:
		print('YES')
		print(i, i + 1)
		from sys import exit
		exit()
print('NO')


n = int(input())
s = input()
t = 0
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print('YES')
		print(i + 1, i + 2)
		t = 1
		break
if not t:
	print('NO')


n = int(input())
S = list(input())
T = sorted(S)
if S == T:
	print('NO')
else:
	for i in range(n):
		if T[i] != S[i]:
			start = i
			break
	for i in range(start + 1, n):
		if S[start] > S[i]:
			break
	print('YES')
	print(start + 1, i + 1)


n = int(input().strip())
s = input().strip()
if list(s) == list(sorted(s)):
	print('NO')
else:
	print('YES')
	x = ''.join(sorted(s))
	for i in range(n):
		if x[i] != s[i]:
			ind = i
			break
	for i in range(ind + 1, n):
		if s[i] < s[ind]:
			print(ind + 1, i + 1)
			break


n = int(input())
s = input()
good_pairs = [i for i in range(1, n) if s[i] < s[i - 1]]
print('NO' if not good_pairs else 'YES\n' + str(good_pairs[0]) + ' ' + str(good_pairs[0] + 1))


n = int(input())
s = input()
flag = 0
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		flag = 1
		break
if flag == 1:
	print('YES')
	print(str(i + 1) + ' ' + str(i + 2))
else:
	print('NO')


n = int(input())
s = str(input())
arr = [i for i in s]
arr.sort()
t = ''.join(arr)
if s == t:
	print('NO')
else:
	print('YES')
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			print(i + 1, i + 2)
			break


l = input().split()
l = int(l[0])
x = input().split()
x = x[0]
a = 0
for i in range(1, l):
	if ord(x[i - 1]) > ord(x[i]):
		print('YES')
		print(i, i + 1)
		a = 1
		break
if a == 0:
	print('NO')


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		x = self.next_int()
		s = self.next()
		for i in range(1, x):
			if s[i] < s[i - 1]:
				print('YES')
				print(i, i + 1)
				return
		print('NO')
Main().solve()


n = int(input())
ch = input()
i = 0
while i < n - 1 and ord(ch[i]) <= ord(ch[i + 1]):
	i = i + 1
if i == n - 1:
	print('NO')
else:
	print('YES')
	print(i + 1, i + 2)


a = int(input())
s = str(input())
n = a - 1
flag = False
for i in range(n):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		flag = True
		break
if flag == False:
	print('NO')


def main():
	n = int(input())
	s = list(input())
	for i in range(1, n):
		if ord(s[i]) < ord(s[i - 1]):
			print('YES')
			print(i, i + 1)
			return 0
	print('NO')
	return 0
main()


def solve():
	n = int(input())
	s = list(input())
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			print('YES')
			print(f'{i + 1} {i + 2}')
			return
	print('NO')
solve()


import sys, collections
n = int(sys.stdin.readline())
arr = list(sys.stdin.readline().rstrip())
temp = []
for i in arr:
	temp.append(ord(i))
can = False
idx = []
for i in range(n - 1):
	if temp[i] > temp[i + 1]:
		idx.append((i + 1, i + 2))
if idx:
	print('YES')
	print(idx[0][0], idx[0][1])
else:
	print('NO')


n = int(input())
s = list(input())
fl = -1
for i in range(n - 1):
	if s[i + 1] < s[i]:
		print('YES')
		print(i + 1, ' ', i + 2)
		fl = 1
		break
if fl == -1:
	print('NO')


input()
word1 = input()

def str_reverse(word):
	for (idx, letter) in enumerate(word):
		if idx != len(word) - 1:
			if word[idx] > word[idx + 1]:
				print('YES')
				print(idx + 1, idx + 2)
				return
	print('NO')
str_reverse(word1)


n = int(input())
x = input()
s = 0
for i in range(n - 1):
	if x[i] > x[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		s = 1
		break
if s == 0:
	print('NO')


n = int(input())
s = input()
yes = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		yes = True
		print('YES')
		print(str(i + 1) + ' ' + str(i + 2))
		break
if not yes:
	print('NO')


n = int(input())
s = input()
prev = 'a'
for (i, c) in enumerate(s):
	if c < prev:
		print('YES')
		print(i, i + 1)
		break
	else:
		prev = c
else:
	print('NO')


import math
size = int(input())
string = str(input())
so = sorted(string)
if len(string) == 1:
	print('NO')
if so == list(string):
	print('NO')
for i in range(1, len(string)):
	if string[i] < string[i - 1]:
		print('YES')
		print(i, i + 1)
		break


t = int(input())
s = str(input())
(flag, beg, end) = (False, 0, 0)
for i in range(0, len(s) - 1):
	if s[i] > s[i + 1]:
		beg = i + 1
		end = i + 2
		flag = True
		break
if flag == False:
	print('No')
else:
	print('Yes')
	print(beg, end)


N = int(input())
S = input()
for i in range(1, N):
	if S[i] < S[i - 1]:
		print('YES')
		print(i, i + 1)
		exit(0)
print('NO')


n = int(input())
try:
	while True:
		s = input()
		if len(s) > 0:
			continue
		else:
			break
except EOFError:
	pass
x = []
y = []
for i in s:
	x.append(i)
	y.append(i)
x.sort()
if x == y:
	print('NO')
else:
	for i in range(len(s)):
		if y[i + 1] < y[i]:
			print('YES')
			print(i + 1, end=' ')
			print(i + 2)
			break


def main():
	from sys import stdin, stdout
	n = int(stdin.readline().rstrip())
	s = stdin.readline().rstrip()
	flag = True
	for i in range(n - 1):
		if s[i] <= s[i + 1]:
			continue
		else:
			stdout.write('YES\n' + str(i + 1) + ' ' + str(i + 2) + '\n')
			flag = False
			return
	if flag == True:
		stdout.write('NO\n')
		return
	for i in range(n):
		for j in range(n - 1, i, -1):
			if s[i] > s[j]:
				stdout.write('YES\n' + str(i + 1) + ' ' + str(j + 1) + '\n')
				return
	stdout.write('NO\n')
main()


n = int(input())
s = input()
flag = 0
for i in range(n - 1):
	if s[i + 1] < s[i]:
		flag = 1
		break
if flag == 1:
	print('YES')
	print(i + 1, i + 2, sep=' ')
else:
	print('NO')


n = int(input())
s = input()
chk = False
cur = s[0]
(l, r) = (1, 1)
for i in range(1, n):
	if s[i] >= cur:
		cur = s[i]
		l = i + 1
	else:
		chk = True
		r = i + 1
		break
if chk:
	print('YES')
	print(l, r)
else:
	print('NO')


def substring_rearrange(s):
	dup = sorted(s)
	if list(s) == dup:
		return 'NO'
	else:
		i = 0
		s = list(s)
		start = ''
		while i < len(s):
			if dup[i] != s[i]:
				start = i + 1
				ref = dup[i]
				break
			else:
				i += 1
		search = lambda x, y, start: [j + 1 for (d, j) in zip(y, range(len(y))) if d == x and j > start - 1]
		end = search(ref, s, start)[0]
		return 'YES\n' + str(start) + ' ' + str(end)
n = int(input())
print(substring_rearrange(input()))


n = int(input().strip())
s = input().strip()
ans = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print('YES')
		l = i + 1
		r = l + 1
		print(str(l) + ' ' + str(r))
		ans = True
		break
if not ans:
	print('NO')


n = int(input())
a = list(input())
u = 0
for k in range(n - 1):
	if a[k] > a[k + 1]:
		print('YES')
		print(str(k + 1) + ' ' + str(k + 2))
		u = 1
		break
if u == 0:
	print('NO')


from operator import itemgetter, attrgetter, methodcaller
n = int(input())
s = input()
f = True
i = 0
start = dict()
end = dict()
for i in range(n):
	e = s[i]
	if e not in start:
		start[e] = i
	end[e] = i
i = 0
while i < len(end.keys()) and f:
	x = end[sorted(end.keys())[i]]
	j = i + 1
	while j < len(start.keys()) and f:
		y = start[sorted(start.keys())[j]]
		if x > y:
			print('YES')
			print(y + 1, x + 1)
			f = False
		j += 1
	i += 1
if f:
	print('NO')


n = int(input())
l = list(input())
cnt = [0] * 26
cnt[ord(l[0]) - 97] = 1
st = -1
for i in range(1, n):
	cnt[ord(l[i]) - 97] = 1
	for j in range(ord(l[i]) - 97 + 1, 26):
		if cnt[j] == 1:
			st = i
if st == -1:
	print('NO')
	exit()
print('YES')
rev = -2
for i in range(st):
	if l[i] > l[st]:
		rev = i
		break
print(rev + 1, st + 1)


n = int(input())
s = str(input())
A = []
for i in s:
	A.append(ord(i))
for i in range(n - 1):
	if A[i] > A[i + 1]:
		print('YES')
		print(str(i + 1) + ' ' + str(i + 2))
		exit()
print('NO')


n = int(input())
s = list(input())
if s == sorted(s):
	print('NO')
else:
	flag = 0
	x = sorted(s)
	for i in range(n):
		if ord(s[i]) > ord(x[i]):
			x = i
			break
	for i in range(x, n):
		if ord(s[i]) < ord(s[x]):
			y = i
			break
	print('YES')
	print(x + 1, y + 1)


Input = lambda : map(int, input().split())
n = int(input())
x = input()
for i in range(1, n):
	if x[i] < x[i - 1]:
		print('YES')
		print(i, i + 1)
		exit()
print('NO')


n = int(input())
s = input()
flag = True
for i in range(1, n):
	if s[i] >= s[i - 1]:
		pass
	elif flag:
		print('YES')
		print(i, i + 1)
		flag = False
if flag:
	print('NO')


N = int(input())
S = input()
prev = set()
ans = []
f = False
for s in S:
	for p in prev:
		if s < p:
			ans.append((p, s))
			f = True
	if f:
		break
	prev.add(s)
if len(ans) == 0:
	print('NO')
else:
	print('YES')
	a = S.index(ans[0][0])
	tmp = list(S)
	tmp = tmp[::-1]
	b = tmp.index(ans[0][1])
	print(a + 1, N - b)


n = int(input())
string = input()
i = 1
able = 0
for i in range(1, n):
	if string[i] >= string[i - 1]:
		i += 1
	else:
		able = 1
		break
if able == 1:
	print('YES')
	print(i, end=' ')
	print(i + 1)
else:
	print('NO')


_DEBUG = True
n = int(input())
s = input()

def find_solution(n, a):
	for i in range(0, n - 1):
		if a[i] > a[i + 1]:
			return (i + 1, i + 2)
	return None
solution = find_solution(n, s)
if not solution:
	print('NO')
else:
	print('YES')
	print(solution[0], solution[1])


def main():
	n = int(input())
	string = str(input())
	s = list(string)
	s.sort()
	for i in range(n):
		if string[i] > s[i]:
			for j in range(i + 1, n):
				if string[j] == s[i]:
					print('YES')
					print(i + 1, j + 1)
					return
	print('NO')
	return
main()


def find_substr_inds(s, s_len):
	for i in range(s_len - 1):
		if s[i] > s[i + 1]:
			return (i + 1, i + 2)
	return (-1, -1)
s_len = int(input())
s = input()
inds = find_substr_inds(s, s_len)
if inds == (-1, -1):
	print('NO')
else:
	print('YES')
	print(inds[0], inds[1])


(n, s) = (input(), input())
if ''.join(sorted(s)) == s:
	print('NO')
else:
	print('YES')
	st = [s[i + 1] < s[i] for i in range(len(s) - 1)].index(True)
	print(st + 1, st + 2)


n = int(input())
s = input()
var = 0
for x in range(n - 1):
	if s[x + 1] < s[x]:
		ind = x
		var = 1
		break
if var == 1:
	print('YES')
	print(x + 1, x + 2)
else:
	print('NO')


n = int(input())
a = input()
l = 0
r = 0
for i in range(1, n):
	if a[l] > a[i]:
		r = i
		break
	else:
		l = i
if r == 0:
	print('NO')
else:
	print('YES')
	print(l + 1, r + 1)


def mp():
	return map(int, input().split())
n = int(input())
s = input()
l = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		l = i + 1
		break
if [i for i in s] == sorted([i for i in s]):
	print('NO')
else:
	print('YES')
	print(l, l + 1)


n = int(input())
str1 = input()
flag = 0
for i in range(1, n):
	if ord(str1[i]) < ord(str1[i - 1]):
		print('YES')
		print(i, i + 1)
		flag = 1
		break
if flag == 0:
	print('NO')


n = input()
a = [i for i in input()]
n = 1
f = 0
iold = a[0]
for i in a[1:]:
	if i < iold:
		f = 1
		break
	n += 1
	iold = i
if f:
	print('YES')
	print(n, n + 1)
else:
	print('NO')


from sys import setcheckinterval, setrecursionlimit, stdout
setcheckinterval(1000)
setrecursionlimit(10 ** 6)
iin = lambda : int(input())
lin = lambda : list(map(int, input().split()))
n = iin()
a = input()
a1 = sorted(a)
(l, r) = (0, 0)
for i in range(n):
	if a[i] != a1[i]:
		l = i
		break
else:
	print('NO')
	exit()
for i in range(l + 1, n):
	if a[l] > a[i]:
		r = i
		break
else:
	print('NO')
	exit()
print('YES')
print(l + 1, r + 1)


length = int(input())
string = input()
for i in range(length - 1):
	if ord(string[i]) > ord(string[i + 1]):
		print('YES')
		print(str(i + 1) + ' ' + str(i + 2))
		break
	if i == length - 2:
		print('NO')
		break


import sys
num = sys.stdin.readline().strip()
s = sys.stdin.readline().strip()

def thisFun(s):
	ans = []
	i = 0
	state = True
	while i <= len(s) - 2:
		while s[i] > s[i + 1]:
			print('YES')
			print(str(i + 1) + ' ' + str(i + 2))
			i = i + 1
			return ''
		i = i + 1
	print('NO')
	return ''
thisFun(s)


n = int(input())
s = input()
i = 0
flag = 0
while i < n - 1:
	if ord(s[i]) > ord(s[i + 1]):
		flag = 1
		break
	i = i + 1
if flag == 0:
	print('NO')
else:
	print('YES')
	print(i + 1, i + 2, end=' ')


n = int(input())
c = list(input().lower())
j = str(c[0])
ans = -1
for (v, i) in enumerate(c):
	if i < j:
		ans = v
		print('YES')
		break
	j = i
if ans == -1:
	print('NO')
else:
	print(ans, ans + 1)


import sys, math, queue
MOD = 10 ** 9 + 7
n = int(input())
x = list(input())
for i in range(1, n):
	if x[i] < x[i - 1]:
		print('YES')
		print(i, i + 1)
		exit()
print('NO')


n = int(input())
s = input()
check = False
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print('YES')
		print(i + 1, i + 2)
		check = True
		break
if check == False:
	print('NO')


n = int(input())
s = input()
import sys
for i in range(1, n):
	if ord(s[i]) < ord(s[i - 1]):
		print('YES')
		print(i, end=' ')
		print(i + 1)
		sys.exit(0)
print('NO')


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	s = str(input())
	f = 1
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			print('YES')
			print(i + 1, i + 2)
			f = 0
			break
	if f:
		print('NO')
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


_ = input()
s = input()
if len(s) < 2:
	print('NO')
	exit()
for (index, c) in enumerate(s[1:], start=1):
	if s[index - 1] > s[index]:
		print('YES')
		print(index, index + 1)
		exit()
print('NO')


t = int(input())
s = input()
b = False
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print('YES')
		print(i + 1, ' ', i + 2)
		b = True
		break
if b == False:
	print('NO')


n = int(input())
a = list(input())
f = 0
for i in range(n - 1):
	if ord(a[i]) > ord(a[i + 1]):
		f = 1
		l = i + 1
		r = i + 2
		break
if f == 0:
	print('NO')
else:
	print('YES')
	print(l, r)


def chk():
	n = int(input())
	st = str(input())
	mchr = st[0]
	m = 0
	for (i, vi) in enumerate(st[1:], 1):
		if vi < mchr:
			print('YES')
			print(m + 1, i + 1)
			return
		else:
			mchr = vi
			m = i
	print('NO')
chk()


n = int(input())
s = input()
tup = []
for i in range(n):
	tup.append([s[i], i])
tup.sort()
count = 0
for i in range(n):
	if tup[i][1] == count:
		count += 1
		continue
	else:
		print('YES')
		print(count + 1, tup[i][1] + 1)
		break
else:
	print('NO')


n = int(input())
s = input()
(l, r) = (0, 0)
for (i, c) in enumerate(s[1:], 1):
	if c < s[l]:
		r = i
		break
	elif c > s[l]:
		l = i
if l >= r:
	print('NO')
else:
	print('YES')
	print(l + 1, r + 1)


n = int(input())
a = input()
ans = []
for i in range(n - 1):
	if a[i] > a[i + 1]:
		ans = [i + 1, i + 2]
		break
if len(ans) > 0:
	print('YES')
	print(*ans)
else:
	print('NO')


n = int(input())
str = input()
ind = 1
flag = True
for i in range(len(str) - 1):
	if str[ind] < str[ind - 1]:
		print('YES\n', ind, ' ', ind + 1, sep='')
		flag = False
		break
	ind += 1
if flag:
	print('NO')


import sys
n = int(sys.stdin.readline())
s = list(sys.stdin.readline())
s = s[:-1]
for (i, c) in enumerate(s):
	if i > 0:
		if s[i - 1] > s[i]:
			sys.stdout.write('YES\n')
			sys.stdout.write(str(i) + ' ' + str(i + 1))
			sys.exit(0)
sys.stdout.write('NO')


n = int(input())
s = input()
for i in range(0, n - 1):
	p = s[i:i + 2]
	q = p[::-1]
	if q < p:
		print('YES')
		print(i + 1, i + 2)
		break
else:
	print('NO')


n = int(input())
a = list(str(input()))
k = 0
l = 0
m = 0
for i in range(1, n):
	if ord(a[i]) < ord(a[i - 1]):
		k = 1
		l = i
		m = i + 1
		break
if k == 0:
	print('NO')
else:
	print('YES')
	print(l, m)


n = int(input())
s = input()
for i in range(1, n):
	if ord(s[i]) - ord(s[i - 1]) >= 0:
		continue
	else:
		print('YES')
		print(str(i) + ' ' + str(i + 1))
		exit(0)
print('NO')


def indexf(p, a):
	for i in range(len(p) - 1, -1, -1):
		if p[i] == a:
			return i
			break
a = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
s = list(input())
if s == sorted(s):
	print('NO')
else:
	f = 0
	print('YES')
	h = a.index(sorted(s)[n - 1])
	for j in range(h, -1, -1):
		if a[j] in s:
			for i in range(0, j):
				if a[i] in s:
					p = indexf(s, a[i])
					if p > s.index(a[j]):
						print(s.index(a[j]) + 1, p + 1)
						f = 1
						break
		if f == 1:
			break


n = int(input())
s = input()
index = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		index = i
if index == -1:
	print('NO')
else:
	print('YES\n', index + 1, index + 2)


(n, s) = (int(input()), input())
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print('YES')
		print(i + 1, i + 2, sep=' ')
		return
print('NO')


input()
a = input()
r = -1
for (i, x) in enumerate(zip(a, a[1:])):
	if x[0] > x[1]:
		r = i + 1
print([f'YES\n{r} {r + 1}', 'NO'][r < 0])


n = int(input())
s = str(input())
flag = False
for (idx, x) in enumerate(s[1:]):
	if s[idx] > x:
		print('YES')
		print(str(idx + 1) + ' ' + str(idx + 1 + 1))
		flag = True
		break
if not flag:
	print('NO')


n = int(input())
s = str(input())
if sorted(s) == list(s):
	print('NO')
else:
	for i in range(0, len(s) - 1):
		if s[i] > s[i + 1]:
			c = i
			break
	print('YES')
	print(c + 1, c + 2)