import java.util.Scanner;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt(), i = 0, j = 0;

		char[] arr = new char[n];

		String s = sc.next();

		for(i=0;  i<n-1; i++){

			for(j=i+1; j<n; j++){

				if(s.charAt(i) > s.charAt(j))	break;

			}

			if(j < n)	break;

		}

		System.out.println(i == n-1 ? "NO" : (i+1)+" "+(j+1));

	}

}
