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):
        if s[i]!=z[i]:
            print(min(i+1, s.index(z[i])+1), max(i+1, s.index(z[i])+1))
            break