n=int(input())
s=input()
f=True
i=0
a=sorted(list([s[i],i] for i in range(n)),key=lambda x:x[0])
if len(set(s))==1:
       f=False
       print("NO")
while((i<n)and(f)):
    s1,n1=a[i]     
    j=i+1
    while((j<n)and (f)):
        s2,n2=a[j]
        if (s1!=s2) and n2<n1:
         print(n2+1,n1+1)
         f=False
        j+=1    
    i+=1        
if f:
    print("NO")
