/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public final class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String s1[] = br.readLine().split(" ");
		int a[] = new int[n];
		for(int i = 0; i < n ; i++)
		{
			a[i] = Integer.parseInt(s1[i]);
		}
		int l = 0;
		int f = 0;
		int v = 0;
		int q = 0;
		inner:
		for(int i = 0 ;i < n - 1 ; i++){
			//System.out.println(i);
			if(a[i] < a[i+1])
				continue;
			else
			{
				if(v == 0){
					v++;
					l = i;
					outer:
					for(int j = i ; j < n-1 ; j++){
						//System.out.println(j);
						if(a[j] > a[j+1]){
							i = j;
							f = j+1;
							continue;
						}
						else{
							f = j;
							i = j - 1;
							//System.out.println("here");
							Arrays.sort(a,l,f+1);
							//System.out.println("here2222");
							break outer;
						}
					}
				}
				else
				{
					q = 1;
					System.out.println("no");
					break inner;
				}
			}

		}
		if( q==0)
		{
			if (l == 0){
				System.out.println("yes");
				System.out.println((l+1) + " "+(f+1));
			}
			//System.out.printf("%s\n",Arrays.toString(a));
			if (l > 0 && (a[l] > a[l - 1])){
				System.out.println("yes");
				System.out.println((l+1) + " "+(f+1));
			}
			if(l > 0 && (a[l] < a[l-1]))
				System.out.println("no");
		}
	}
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public final class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String s1[] = br.readLine().split(" ");
		int a[] = new int[n];
		for(int i = 0; i < n ; i++)
		{
			a[i] = Integer.parseInt(s1[i]);
		}
		int l = 0;
		int f = 0;
		int v = 0;
		int q = 0;
		inner:
		for(int i = 0 ;i < n - 1 ; i++){
			//System.out.println(i);
			if(a[i] < a[i+1])
				continue;
			else
			{
				if(v == 0){
					v++;
					l = i;
					outer:
					for(int j = i + 1 ; i < n-1 ; j++){
						if(a[j] > a[j+1])
							continue;
						else{
							f = j;
							i = j - 1;
							Arrays.sort(a,l,f+1);
							break outer;
						}
					}
				}
				else
				{
					q = 1;
					System.out.println("no");
					break inner;
				}
			}

		}
		if( q==0)
		{
			System.out.println("yes");
			System.out.println((l+1) + " "+(f+1));
			//System.out.printf("%s\n",Arrays.toString(a));
		}
	}
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public final class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String s1[] = br.readLine().split(" ");
		int a[] = new int[n];
		for(int i = 0; i < n ; i++)
		{
			a[i] = Integer.parseInt(s1[i]);
		}
		int l = 0;
		int f = 0;
		int v = 0;
		int q = 0;
		inner:
		for(int i = 0 ;i < n - 1 ; i++){
			//System.out.println(i);
			if(a[i] < a[i+1])
				continue;
			else
			{
				if(v == 0){
					v++;
					l = i;
					outer:
					for(int j = i ; j < n-1 ; j++){
						//System.out.println(j);
						if(a[j] > a[j+1]){
							i = j;
							f = j+1;
							continue;
						}
						else{
							f = j;
							i = j - 1;
							//System.out.println("here");
							Arrays.sort(a,l,f+1);
							//System.out.println("here2222");
							break outer;
						}
					}
				}
				else
				{
					q = 1;
					System.out.println("no");
					break inner;
				}
			}

		}
		if( q==0)
		{
			//if (l == 0){
				//System.out.println("yes");
				//System.out.println((l+1) + " "+(f+1));
			//}
			//System.out.printf("%s\n",Arrays.toString(a));
			if (l >= 0 && (a[l] < a[l - 1])){
				System.out.println("yes");
				System.out.println((l+1) + " "+(f+1));
			}
			else
				System.out.println("no");
		}
	}
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public final class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String s1[] = br.readLine().split(" ");
		int a[] = new int[n];
		for(int i = 0; i < n ; i++)
		{
			a[i] = Integer.parseInt(s1[i]);
		}
		int l = 0;
		int f = 0;
		int v = 0;
		int q = 0;
		inner:
		for(int i = 0 ;i < n - 1 ; i++){
			//System.out.println(i);
			if(a[i] < a[i+1])
				continue;
			else
			{
				if(v == 0){
					v++;
					l = i;
					outer:
					for(int j = i + 1 ; j < n-1 ; j++){
						//System.out.println(j);
						if(a[j] > a[j+1]){
							i = j;
							f = j+1;
							continue;
						}
						else{
							f = j;
							i = j - 1;
							//System.out.println("here");
							Arrays.sort(a,l,f+1);
							//System.out.println("here2222");
							break outer;
						}
					}
				}
				else
				{
					q = 1;
					System.out.println("no");
					break inner;
				}
			}

		}
		if( q==0)
		{
			System.out.println("yes");
			System.out.println((l+1) + " "+(f+1));
			//System.out.printf("%s\n",Arrays.toString(a));
		}
	}
}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B451
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args)
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        int arr[]=new int[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=in.nextInt();
        }
        int l=-1;
        int r=-1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>arr[i+1])
            {
                l=i;
                break;
            }
        }
        for(int i=n-1;i>=1;i--)
        {
            if(arr[i]<arr[i-1])
            {
                r=i;
                break;
            }
        }

        if(l==-1&&r==-1)
        {
            System.out.println("yes");

                System.out.print(1+" "+1);
        }
        else if(l+r==-1)
        {
            System.out.println("no");
        }
        else
        {
            int len=(r-l+1);
            for(int i=l;i<len/2;i++)
            {
                int temp=arr[i];
                arr[i]=arr[len-i-1];
                arr[len-i-1]=temp;
            }
            int flag=1;
            for(int i=0;i<n-1;i++)
            {
                if(arr[i]>arr[i+1])
                {
                    flag=0;
                    break;
                }
            }
            if(flag==0)
                System.out.println("no");

            else
            {
                System.out.println("yes");

                System.out.print(l+1+" "+(r+1));
            }
        }
        }

}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B451
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args)
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        int arr[]=new int[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=in.nextInt();
        }
        int l=-1;
        int r=-1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>arr[i+1])
            {
                l=i;
                break;
            }
        }
        for(int i=n-1;i>=1;i--)
        {
            if(arr[i]<arr[i-1])
            {
                r=i;
                break;
            }
        }
        if(l==-1&&r==-1)
        {
            System.out.println("yes");

                System.out.print(1+" "+1);
        }
        else if(l+r==-1)
        {
            System.out.println("no");
        }
        else
        {
            int len=(r-l+1);
            if(l==0)
            {
                for(int i=l;i<len/2;i++)
                {
                    int temp=arr[i];

                    arr[i]=arr[len-i-1];
                    arr[len-i-1]=temp;

                }
            }
            else
            {
                for(int i=l;i<=len/2;i++)
                {
                    int temp=arr[i];

                    arr[i]=arr[len+1-i];
                    arr[len-i+1]=temp;

                }

            }
            int flag=1;
            for(int i=0;i<n-1;i++)
            {
                if(arr[i]>arr[i+1])
                {
                    flag=0;
                    break;
                }
            }
            if(flag==0)
                System.out.println("no");

            else
            {
                System.out.println("yes");

                System.out.print(l+1+" "+(r+1));
            }
        }
        }

}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B451
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args)
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        int arr[]=new int[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=in.nextInt();
        }
        int l=-1;
        int r=-1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>arr[i+1])
            {
                l=i;
                break;
            }
        }
        for(int i=n-1;i>=1;i--)
        {
            if(arr[i]<arr[i-1])
            {
                r=i;
                break;
            }
        }

        if(l==-1&&r==-1)
        {
            System.out.println("yes");

                System.out.print(1+" "+1);
        }
        else if(l+r==-1)
        {
            System.out.println("no");
        }
        else
        {
            int len=(r-l+1);
            for(int i=l;i<=len/2;i++)
            {
                int temp=arr[i];
                if(l!=0)
                {
                    arr[i]=arr[len+1-i];
                    arr[len-i+1]=temp;
                }
                else
                {
                    arr[i]=arr[len-i-1];
                    arr[len-i-1]=temp;
                }
            }

            int flag=1;
            for(int i=0;i<n-1;i++)
            {
                if(arr[i]>arr[i+1])
                {
                    flag=0;
                    break;
                }
            }
            if(flag==0)
                System.out.println("no");

            else
            {
                System.out.println("yes");

                System.out.print(l+1+" "+(r+1));
            }
        }
        }

}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B451
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args)
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        long arr[]=new long[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=in.nextLong();
        }
        int l=-1;
        int r=-1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>arr[i+1])
            {
                l=i;
                break;
            }
        }
        for(int i=n-1;i>=1;i--)
        {
            if(arr[i]<arr[i-1])
            {
                r=i;
                break;
            }
        }
        if(l==-1&&r==-1)
        {
            System.out.println("yes");

                System.out.print(1+" "+1);
        }
        else if(l+r==-1)
        {
            System.out.println("no");
        }
        else
        {
            int flag=1;
            if(l!=0)
            {

                if(arr[r]<arr[l-1])
                {
                    flag=0;
                }
            }
            if(flag==1&&r!=n-1)
            {

                if(arr[l]>arr[r+1])
                    flag=0;
            }
            if(flag==1)
            {
                for(int i=l;i<=r-1;i++)
                {
                    if(arr[i]<arr[i+1])
                        {
                            flag=0;
                            break;
                        }
                }
            }
            if(flag==1)
            {
                System.out.println("yes");
                System.out.print(l+1+" "+(r+1));
            }
            else
                System.out.println("no");
        }
        }

}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B451
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args)
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        long arr[]=new long[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=in.nextLong();
        }
        int l=-1;
        int r=-1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>arr[i+1])
            {
                l=i;
                break;
            }
        }
        for(int i=n-1;i>=1;i--)
        {
            if(arr[i]<arr[i-1])
            {
                r=i;
                break;
            }
        }
        if(l==-1&&r==-1)
        {
            System.out.println("yes");

                System.out.print(1+" "+1);
        }
        else if(l+r==-1)
        {
            System.out.println("no");
        }
        else
        {
            int flag=1;
            if(l!=0)
            {
                if(arr[r]<arr[l-1])
                    flag=0;
            }
            else if(flag==1&&r!=n-1)
            {
                if(arr[l]>arr[r+1])
                    flag=0;
            }
            else if(flag==1)
            {
                for(int i=l;i<=r-1;i++)
                {
                    if(arr[i]<arr[i+1])
                        {
                            flag=0;
                            break;
                        }
                }
            }
            if(flag==1)
            {
                System.out.println("yes");
                System.out.print(l+1+" "+(r+1));
            }
            else
                System.out.println("no");
        }
        }

}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class B451
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main (String[] args)
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        int arr[]=new int[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=in.nextInt();
        }
        int l=-1;
        int r=-1;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>arr[i+1])
            {
                l=i;
                break;
            }
        }
        for(int i=n-1;i>=1;i--)
        {
            if(arr[i]<arr[i-1])
            {
                r=i;
                break;
            }
        }

        if(l==-1&&r==-1)
        {
            System.out.println("YES");

                System.out.print(1+" "+1);
        }
        else if(l+r==-1)
        {
            System.out.println("NO");
        }
        else
        {
            int len=(r-l+1);
            for(int i=l;i<len/2;i++)
            {
                int temp=arr[i];
                arr[i]=arr[len-i-1];
                arr[len-i-1]=temp;
            }
            int flag=1;
            for(int i=0;i<n-1;i++)
            {
                if(arr[i]>arr[i+1])
                {
                    flag=0;
                    break;
                }
            }
            if(flag==0)
                System.out.println("NO");

            else
            {
                System.out.println("YES");

                System.out.print(l+1+" "+(r+1));
            }
        }
        }

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = -1;
		int to = -1;
		boolean sorted = false;
		boolean impossible=false;
		int maxfound=0;
		for (int i = 0; i < dat.length-1; i++) {
			if(dat[i]>dat[i+1]) {
				if(sorted) {
					impossible=true;
					break;
				}else {
					if(from==-1) {
						maxfound=dat[i];
						from=i;
						to=i;
					}else {
						to++;
					}
				}
			}else if(from!=-1&&!sorted) {
				to=i;
				sorted=true;
			}else if(maxfound>dat[i]) {
				impossible=true;
				break;
			}
		}
		if(to==n-2&&dat[n-1]>dat[n-2]) {
			to++;
		}
		if(from==-1&&to==-1) {
			from=0;
			to=0;
		}
		if(impossible) {
			System.out.println("no");
		}else {
			System.out.println("yes\n"+(from+1)+" "+(to+1));
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n+1];
		dat[0]=1;
		for (int i = 1; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = 0;
		int to = 0;
		boolean sorted = false;
		boolean impossible=false;
		for (int i = 1; i < dat.length; i++) {
			if(i!=dat[i]) {
				if(sorted||impossible) {
					impossible = true;
					break;
				}
				from = i;
				to = i;
				int ind = i+1;
				while(ind<=n) {
					if((dat[ind-1]-dat[ind])==1) {
						to++;
					}else {
						break;
					}
					ind++;
				}
				sorted = true;
				i=ind;
			}
		}
		if(impossible) {
			System.out.println("no");
		}else{
			if(from==0&&to==0) {
				from++;
				to++;
			}
			System.out.println("yes\n"+from+" "+to);
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		if(n==1) {
			System.out.println("yes\n1 1");
		}else {
			int from = -1;
			int to = -1;
			boolean sorted = false;
			boolean impossible=false;
			int maxfound=0;
			for (int i = 0; i < dat.length-1; i++) {
				if(dat[i]>dat[i+1]) {
					if(sorted) {
						impossible=true;
						break;
					}else {
						if(from==-1) {
							maxfound=dat[i];
							from=i;
							to=i;
						}else {
							to++;
						}
					}
				}else if(from!=-1&&!sorted) {
					to=i;
					sorted=true;
				}else if(maxfound>dat[i]) {
					impossible=true;
					break;
				}
			}
			if(to==n-2&&dat[n-1]<dat[n-2]) {
				to++;
			}else if(to==n-2&&dat[n-1]<maxfound){
				impossible=true;
			}
			if(from==-1&&to==-1) {
				from=0;
				to=0;
			}
			if(impossible) {
				System.out.println("no");
			}else {
				System.out.println("yes\n"+(from+1)+" "+(to+1));
			}
		}

	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = -1;
		int to = -1;
		boolean sorted = false;
		boolean impossible=false;
		int maxfound=0;
		for (int i = 0; i < dat.length-1; i++) {
			if(dat[i]>dat[i+1]) {
				if(sorted) {
					impossible=true;
					break;
				}else {
					if(from==-1) {
						maxfound=dat[i];
						from=i;
						to=i;
					}else {
						to++;
					}
				}
			}else if(from!=-1&&!sorted) {
				to=i;
				sorted=true;
			}else if(maxfound>dat[i]) {
				impossible=true;
				break;
			}
		}
		if(to==n-2&&dat[n-1]<dat[n-2]) {
			to++;
		}else {
			impossible=true;
		}
		if(from==-1&&to==-1) {
			from=0;
			to=0;
		}
		if(impossible) {
			System.out.println("no");
		}else {
			System.out.println("yes\n"+(from+1)+" "+(to+1));
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = -1;
		int to = -1;
		boolean sorted = false;
		boolean impossible=false;
		int maxfound=0;
		for (int i = 0; i < dat.length-1; i++) {
			if(dat[i]>dat[i+1]) {
				if(sorted) {
					impossible=true;
					break;
				}else {
					if(from==-1) {
						maxfound=dat[i];
						from=i;
						to=i;
					}else {
						to++;
					}
				}
			}else if(from!=-1&&!sorted) {
				to=i;
				sorted=true;
			}else if(maxfound>dat[i]) {
				impossible=true;
				break;
			}
		}
		if(to==n-2&&dat[n-1]<dat[n-2]) {
			to++;
		}else if(to==n-2&&dat[n-1]<maxfound){
			impossible=true;
		}
		if(from==-1&&to==-1) {
			from=0;
			to=0;
		}
		if(impossible) {
			System.out.println("no");
		}else {
			System.out.println("yes\n"+(from+1)+" "+(to+1));
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = -1;
		int to = -1;
		boolean sorted = false;
		boolean impossible=false;
		int maxfound=0;
		for (int i = 0; i < dat.length-1; i++) {
			if(dat[i]>dat[i+1]) {
				if(sorted) {
					impossible=true;
					break;
				}else {
					if(from==-1) {
						maxfound=dat[i];
						from=i;
						to=i;
					}else {
						to++;
					}
				}
			}else if(from!=-1&&!sorted) {
				to=i;
				sorted=true;
			}else if(maxfound>dat[i]) {
				impossible=true;
				break;
			}
		}
		if(to==n-2&&dat[n-1]>maxfound) {
			to++;
		}
		if(from==-1&&to==-1) {
			from=0;
			to=0;
		}
		if(impossible) {
			System.out.println("no");
		}else {
			System.out.println("yes\n"+(from+1)+" "+(to+1));
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = -1;
		int to = -1;
		boolean sorted = false;
		boolean impossible=false;
		int maxfound=0;
		for (int i = 0; i < dat.length-1; i++) {
			if(dat[i]>dat[i+1]) {
				if(sorted) {
					impossible=true;
					break;
				}else {
					if(from==-1) {
						maxfound=dat[i];
						from=i;
						to=i;
					}else {
						to++;
					}
				}
			}else if(from!=-1&&!sorted) {
				to=i;
				sorted=true;
			}else if(maxfound>dat[i]) {
				impossible=true;
				break;
			}
		}
		if(to==n-2&&dat[n-1]<dat[n-2]) {
			to++;
		}
		if(from==-1&&to==-1) {
			from=0;
			to=0;
		}
		if(impossible) {
			System.out.println("no");
		}else {
			System.out.println("yes\n"+(from+1)+" "+(to+1));
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		if(n==1) {
			System.out.println("yes\n1 1");
		}else {
			int from = -1;
			int to = -1;
			boolean sorted = false;
			boolean impossible=false;
			int maxfound=0;
			for (int i = 0; i < dat.length-1; i++) {
				if(dat[i]>dat[i+1]) {
					if(sorted) {
						impossible=true;
						break;
					}else {
						if(from==-1) {
							maxfound=dat[i];
							from=i;
							to=i;
						}else {
							to++;
						}
					}
				}else if(from!=-1&&!sorted) {
					to=i;
					sorted=true;
				}else if(maxfound>dat[i]) {
					impossible=true;
					break;
				}
			}
			if(to==n-2&&dat[n-1]<dat[n-2]) {
				to++;
			}else if(to==n-2&&dat[n-1]<maxfound){
				impossible=true;
			}
			if(from>0) {
				if(dat[from-1]>dat[to]) {
					impossible=true;
				}
			}
			if(from==-1&&to==-1) {
				from=0;
				to=0;
			}
			if(impossible) {
				System.out.println("no");
			}else {
				System.out.println("yes\n"+(from+1)+" "+(to+1));
			}
		}

	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = 0;
		int to = 0;
		boolean sorted = false;
		boolean impossible=false;
		for (int i = 1; i <= dat.length; i++) {
			if(i!=dat[i-1]) {
				if(sorted||impossible) {
					impossible = true;
					break;
				}
				from = i;
				to = i;
				int ind = i+1;
				while(ind<=n&&dat[ind-1]!=ind) {
					if(dat[ind-1]==dat[ind-2]-1) {
						to++;
					}else{
						impossible = true;
					}
					ind++;
				}
				sorted = true;
				i=ind;
			}
		}
		if(impossible) {
			System.out.println("no");
		}else{
			if(from==0&&to==0) {
				from++;
				to++;
			}
			System.out.println("yes\n"+from+" "+to);
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n+1];
		dat[0]=1;
		for (int i = 1; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = 0;
		int to = 0;
		boolean sorted = false;
		boolean impossible=false;
		for (int i = 1; i < dat.length; i++) {
			if(i!=dat[i]) {
				if(sorted||impossible) {
					impossible = true;
					break;
				}
				from = i;
				to = i;
				int ind = i+1;
				while(ind<=n) {
					if((dat[ind-1]>dat[ind])) {
						to++;
					}else {
						break;
					}
					ind++;
				}
				sorted = true;
				i=ind;
			}
		}
		if(impossible) {
			System.out.println("no");
		}else{
			if(from==0&&to==0) {
				from++;
				to++;
			}
			System.out.println("yes\n"+from+" "+to);
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = -1;
		int to = -1;
		boolean sorted = false;
		boolean impossible=false;
		int maxfound=0;
		for (int i = 0; i < dat.length-1; i++) {
			if(dat[i]>dat[i+1]) {
				if(sorted) {
					impossible=true;
					break;
				}else {
					if(from==-1) {
						maxfound=dat[i];
						from=i;
						to=i;
					}else {
						to++;
					}
				}
			}else if(from!=-1&&!sorted) {
				to=i;
				sorted=true;
			}else if(maxfound>dat[i]) {
				impossible=true;
				break;
			}
		}
		if(to==n-2&&dat[n-1]<dat[n-2]) {
			to++;
		}else if(to==n-2&&dat[n-1]>dat[n-2]){
			impossible=true;
		}
		if(from==-1&&to==-1) {
			from=0;
			to=0;
		}
		if(impossible) {
			System.out.println("no");
		}else {
			System.out.println("yes\n"+(from+1)+" "+(to+1));
		}
	}

}


import java.util.Scanner;

public class CF451B {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] dat = new int[n];
		for (int i = 0; i < dat.length; i++) {
			dat[i]=s.nextInt();
		}
		int from = 0;
		int to = 0;
		boolean sorted = false;
		boolean impossible=false;
		for (int i = 1; i <= dat.length; i++) {
			if(i!=dat[i-1]) {
				if(sorted||impossible) {
					impossible = true;
					break;
				}
				from = i;
				to = i;
				int ind = i+1;
				while(ind<=n) {
					if(dat[ind-1]==dat[ind-2]-1) {
						to++;
					}else {
						impossible = true;
					}
					ind++;
				}
				sorted = true;
				i=ind;
			}
		}
		if(impossible) {
			System.out.println("no");
		}else{
			if(from==0&&to==0) {
				from++;
				to++;
			}
			System.out.println("yes\n"+from+" "+to);
		}
	}

}


mport java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		int k = (int) Math.ceil(s/2);
		while(k>0){
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		if(c1 == 0){
		 c1 = t+1;
		 c2 = t1+1;
		}
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}
			k--;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		int k = (int) Math.ceil(s/2);
		while(k>0){
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		if(c1 == 0){
		 c1 = t+1;
		 c2 = t1+1;
		}
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}
			k--;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.util.*;
public class Main {

	void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		long[] arr = new long[s];
		long[] ar = new long[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		System.out.println (t);
		System.out.println (t1);
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t; t1>=i;i++,t1--){
				long temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);

		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		int c1 = ar[t];
		int c2 = ar[t1];
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);

		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		int c1 = ar[t];
		int c2 = ar[t1];
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1>c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);

		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		int c1 = t;
		int c2 = t1;
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.util.*;
public class Main {

	void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		long[] arr = new long[s];
		long[] ar = new long[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		//System.out.println (t);
		//System.out.println (t1);
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t;i<c&& t1>=i;i++,t1--){
				long temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		//System.out.println (t);
		//System.out.println (t1);
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t;i<c&& t1>=i;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t;i<c-1;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			for(int i=0;i<s;i++){
				//System.out.println (ar[i]);
			}
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		System.out.println (t);
		System.out.println (t1);
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t;i<c&& t1>=i;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class Main {

	void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		int[] arr = new int[s];
		int[] ar = new int[s];
		int t=0;
		int t1=0;
		int c=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);

		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		/*System.out.println (t);
		System.out.println (t1);*/
		c = t1-t;
		int c1 = t+1;
		int c2 = t1+1;
			for(int i=t;i<c;i++,t1--){
				int temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			/*for(int i=0;i<s;i++){
				System.out.println (ar[i]);
			}*/
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.util.*;
public class Main {

	void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining e
         * lements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Main m = new Main();
		Scanner g = new Scanner(System.in);
		int s = g.nextInt();
		long[] arr = new long[s];
		long[] ar = new long[s];
		int t=0;
		int t1=0;
		int c=0;
		int c1,c2;
		c1=c2=0;
		boolean b= true;
		for(int i=0;i<s;i++){
			arr[i] = g.nextInt();
			ar[i ]= arr[i];
		}
		//ar = arr;

		m.sort(arr,0,s-1);
		for(int i=0;i<s;i++){
			if(arr[i] != (ar[i])){
				t=i;
				//System.out.println (t);
				break;
			}
		}
		for(int i=s-1;i>0;i--){

			if(arr[i] != ar[i]){
				t1=i;
				//System.out.println (t1);
				break;
			}
		}
		//System.out.println (t);
		//System.out.println (t1);
		c = t1-t;
		 c1 = t+1;
		 c2 = t1+1;
			for(int i=t; t1>=i;i++,t1--){
				long temp = ar[i] ;
				ar[i] = ar[t1];
				ar[t1] = temp;
		}

			for(int i=0;i<s;i++){
				//System.out.println (ar[i]);
			}
			for(int i=0;i<s;i++){
				if(ar[i]!=arr[i]){
					b = false;
				}
			}

			if(b){
				if(c1<c2){
				System.out.println ("yes");
				System.out.println (c1+" "+c2);
				}else{
					System.out.println ("yes");
					System.out.println (c2+" "+c1);
				}
			}else{
				System.out.println ("no");
			}

		//System.out.println((max));

		}
		}


import java.util.*;
import java.lang.*;
import java.io.*;

public class codeforces{
    public static void main (String[] args)throws IOException {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();

	    int[] arr = new int[n];
	    int[] sot = new int[n];
	    for(int i = 0; i < n; i++)
	        arr[i] = sc.nextInt();
	    int l = 0, r = 0;
	    for(int i = 0; i < n-1; i++)
	        if(arr[i]!=i+1){
	            l = i;
	            break;
	        }

	    for(int i = l+1; i <= n; i++)
	        if(arr[i]!=i+1){
	            r = i;
	            break;
	        }
	    for(int i = 0; i < n; i++)
	        sot[i]=i+1;

	    reverse(arr,l,r);
	    if(equalArray(arr,sot))System.out.println("yes");
	    else System.out.println("no");
    }
    static boolean equalArray(int[] a, int[] b){
        for(int i = 0; i < a.length; i++){
            if(a[i] != b[i])return false;
        }
        return true;
    }

    static void reverse(int[] c, int l, int r){
        while(l < r){
            int temp = c[l];
            c[l] = c[r];
            c[r] = temp;
            l++;
            r--;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class codeforces{
    public static void main (String[] args)throws IOException {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();

	    int[] arr = new int[n];
	    int[] sot = new int[n];
	    for(int i = 0; i < n; i++)
	        arr[i] = sc.nextInt();
	    int l = 0, r = 0;
	    for(int i = 0; i < n-1; i++)
	        if(arr[i]!=i+1){
	            l = i;
	            break;
	        }

	    for(int i = l+1; i <= n; i++)
	        if(arr[i]!=i+1){
	            r = i;
	            break;
	        }
	    for(int i = 0; i < n; i++)
	        sot[i]=i+1;

	    reverse(arr,l,r);
	    if(equalArray(arr,sot)){
	        System.out.println("yes");
	        System.out.println(l+1+" "+r+1);
	    }
	    else System.out.println("no");
    }
    static boolean equalArray(int[] a, int[] b){
        for(int i = 0; i < a.length; i++){
            if(a[i] != b[i])return false;
        }
        return true;
    }

    static void reverse(int[] c, int l, int r){
        while(l < r){
            int temp = c[l];
            c[l] = c[r];
            c[r] = temp;
            l++;
            r--;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class codeforces{
    public static void main (String[] args)throws IOException {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();

	    int[] arr = new int[n];
	    int[] sot = new int[n];
	    for(int i = 0; i < n; i++)
	        arr[i] = sc.nextInt();
	    int l = 0, r = 0;
	    for(int i = 0; i < n-1; i++)
	        if(arr[i]>arr[i+1]){
	            l = i;
	            break;
	        }

	    for(int i = l+1; i < n-1; i++)
	        if(arr[i]<arr[i+1]){
	            r = i;
	            break;
	        }
	    for(int i = 0; i < n; i++)
	        sot[i]=i+1;

	    reverse(arr,l,r);
	    if(equalArray(arr,sot)){
	        System.out.println("yes");
	        System.out.println((l+1)+" "+(r+1));
	    }
	    else System.out.println("no");
    }
    static boolean equalArray(int[] a, int[] b){
        for(int i = 0; i < a.length; i++){
            if(a[i] != b[i])return false;
        }
        return true;
    }

    static void reverse(int[] c, int l, int r){
        while(l < r){
            int temp = c[l];
            c[l] = c[r];
            c[r] = temp;
            l++;
            r--;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e18
#define NEG_INF -1e18
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;

struct points
{
	ll x;
	ll y;
	ll z;
	ll id;

} data[1000000];

struct comp
{
    bool operator() (points a,points b)
	{
		if(a.x!=b.x)
			return a.x<b.x;
		else if(a.y!=b.y)
			return a.y<b.y;
		else
			return a.z<b.z;

	}

};
ll visited[1000000];
int main()
{
	IOS;
	multiset<points,comp> s;
	ll n;
	cin>>n;
	ll i,j;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		data[i].id=i;
		s.insert(data[i]);
	}

	while(!s.empty())
	{
		auto temp=s.begin();
		auto itr=temp;
		auto xl=itr;
		lb temp2=INF;
		ll pos=-1;
		itr++;
		ll abba=(*itr).x;
		while(itr!=s.end())
		{
			if(abba!=(*itr).x)
				break;
			i=(*temp).id;j=(*itr).id;
			lb temp1=pow(abs(data[i].x-data[j].x),2)+pow(abs(data[i].y-data[j].y),2)+pow(abs(data[i].z-data[j].z),2);
			temp1=sqrt(temp1);
			if(temp2>temp1)
			{
				temp2=temp1;
				pos=j;
				xl=itr;
			}
			itr++;
		}
 		s.erase(temp);s.erase(xl);
		cout<<data[i].id+1<<" "<<data[pos].id+1<<endl;
		trace1(pos);
	}
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e18
#define NEG_INF -1e18
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;

struct points
{
	ll x;
	ll y;
	ll z;
	ll id;

} data[1000000];

struct comp
{
    bool operator() (points a,points b)
	{
		if(a.x!=b.x)
			return a.x<b.x;
		else if(a.y!=b.y)
			return a.y<b.y;
		else
			return a.z<b.z;

	}

};
ll visited[1000000];
int main()
{
	IOS;
	multiset<points,comp> s;
	ll n;
	cin>>n;
	ll i,j;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		data[i].id=i;
		s.insert(data[i]);
	}

	while(!s.empty())
	{
		auto temp=s.begin();
		auto itr=temp;
		auto xl=itr;
		lb temp2=INF;
		ll pos=-1;
		itr++;
		ll abba=(*itr).x;
		ll cou=0
		while(itr!=s.end())
		{
			if(abba!=(*itr).x||cou>1000)
				break;

			cou++;
			i=(*temp).id;j=(*itr).id;
			lb temp1=pow(abs(data[i].x-data[j].x),2)+pow(abs(data[i].y-data[j].y),2)+pow(abs(data[i].z-data[j].z),2);
			temp1=sqrt(temp1);
			if(temp2>temp1)
			{
				temp2=temp1;
				pos=j;
				xl=itr;
			}
			itr++;
		}
 		s.erase(temp);s.erase(xl);
		cout<<data[i].id+1<<" "<<data[pos].id+1<<endl;
		trace1(pos);
	}
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1000000000000
#define NEG_INF -1000000000000
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;
struct points
{
	ll x;
	ll y;
	ll z;
	ll id;

} data[10000];
bool comp(points a,points b)
{
	if(a.x!=b.x)
		return a.x<b.x;
	else if(a.y!=b.y)
		return a.y<b.y;
	else
		return a.z<b.z;

}
int main()
{
	IOS;
	ll n;
	cin>>n;
	ll i;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		data[i].id=i+1;
	}

	sort(data,data+n,comp);
	reverse(data,data+n);
	rloop(i,0,n/2)
	{
		cout<<data[i*2].id<<" "<<data[i*2+1].id<<endl;
	}
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1000000000000
#define NEG_INF -1000000000000
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;

struct points
{
    ll x;
    ll y;
    ll z;
    ll id;

    bool operator<(const points& b) const
    {
        if(this->x!=b.x)
            return this->x<b.x;
        else if(this->y!=b.y)
            return this->y<b.y;
        else
            return this->z<b.z;
    }

}data[100000];
multiset<points> s;

int main()
{
	IOS;
	ll n;
	cin>>n;
	ll i;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		data[i].id=i+1;
		s.insert(data[i]);
	}

	while(!s.empty())
	{
		auto a=s.begin();
		auto itr1=a;
		points temp;
		//for x
		{

			temp.x=(*a).x;
			temp.y=NEG_INF;
			temp.z=NEG_INF;
			itr1=s.lower_bound(temp);
			if(itr1==a)
				itr1++;
		}

		//for y
		{
			temp.x=(*itr1).x;
			temp.y=(*a).y;
			itr1=s.lower_bound(temp);
			if(itr1==a)
				itr1++;
			if(itr1==s.end()||(*itr1).x!=temp.x)
				itr1--;

		}

		//for z
		{
			temp.x=(*itr1).x;
			temp.y=(*itr1).y;
			temp.z=	(*a).z;
			itr1=s.lower_bound(temp);
			if(itr1==a)
				itr1++;
			if(itr1==s.end()|| ( ( (*itr1).x!=temp.x)||(*itr1).y!=temp.y ))
				itr1--;

		}

		cout<<(*a).id<<" "<<(*itr1).id<<endl;
		s.erase(a);
		s.erase(itr1);
	}
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1000000000000
#define NEG_INF -1000000000000
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;
struct points
{
	ll x;
	ll y;
	ll z;
	ll id;

} data[10000];
bool comp(points a,points b)
{
	if(a.x!=b.x)
		return a.x<b.x;
	else if(a.y!=b.y)
		return a.y>b.y;
	else
		return a.z>b.z;

}
int main()
{
	IOS;
	ll n;
	cin>>n;
	ll i;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		data[i].id=i+1;
	}

	sort(data,data+n,comp);
	//reverse(data,data+n);
	loop(i,0,n/2)
	{
		cout<<data[i*2].id<<" "<<data[i*2+1].id<<endl;
	}
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e18
#define NEG_INF -1e18
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;

struct points
{
	ll x;
	ll y;
	ll z;
	ll id;

} data[1000000];
bool comp(points a,points b)
{
	if(a.x!=b.x)
		return a.x<b.x;
	else if(a.y!=b.y)
		return a.y<b.y;
	else
		return a.z<b.z;

}
ll visited[1000000];
int main()
{
	IOS;
	multiset<pll> x1,y1,z1;
	ll n;
	cin>>n;
	ll i,j;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		x1.insert({data[i].x,i+1});
		y1.insert({data[i].y,i+1});
		z1.insert({data[i].z,i+1});
		data[i].id=i+1;
	}

	//sort(data,data+n,comp);
	loop(i,0,n)
	{
		if(visited[i]==1)
			continue;
		lb temp=INF;
		ll pos=-1;

		loop(j,i+1,n)
		{
			if(data[j].x!=data[i].x&&pos!=-1)
				break;
			if(visited[j]==1)
				continue;
			lb temp1=pow(abs(data[i].x-data[j].x),2)+pow(abs(data[i].y-data[j].y),2)+pow(abs(data[i].z-data[j].z),2);
			temp1=sqrt(temp1);
			if(temp>temp1)
			{
				temp=temp1;
				pos=j;
			}
		}

		visited[pos]=1;
		cout<<i+1<<" "<<pos+1<<endl;
		trace1(pos);
	}
}


#include<bits/stdc++.h>
#define ll long long
#define lb long double
#define mp make_pair
#define pb push_back
#define loop(i,start,n) for(i=start;i<n;i++)
#define rloop(i,n,start)for(i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e18
#define NEG_INF -1e18
#define pll pair<ll,ll>
#define x first
#define y second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;

struct points
{
	ll x;
	ll y;
	ll z;
	ll id;

} data[1000000];
bool comp(points a,points b)
{
	if(a.x!=b.x)
		return a.x<b.x;
	else if(a.y!=b.y)
		return a.y<b.y;
	else
		return a.z<b.z;

}
ll visited[1000000];
int main()
{
	IOS;
	multiset<pll> x1,y1,z1;
	ll n;
	cin>>n;
	ll i,j;
	loop(i,0,n)
	{
		cin>>data[i].x>>data[i].y>>data[i].z;
		x1.insert({data[i].x,i+1});
		y1.insert({data[i].y,i+1});
		z1.insert({data[i].z,i+1});
		data[i].id=i+1;
	}

	sort(data,data+n,comp);
	loop(i,0,n)
	{
		if(visited[i]==1)
			continue;
		lb temp=INF;
		ll pos=-1;
		j=i+1;
		while(visited[j]==1)
			j++;
		ll intial=j;
		loop(j,j,n)
		{
			if(data[j].x!=data[intial].x)
				break;
			if(visited[j]==1)
				continue;
			lb temp1=pow(abs(data[i].x-data[j].x),2)+pow(abs(data[i].y-data[j].y),2)+pow(abs(data[i].z-data[j].z),2);
			temp1=sqrt(temp1);
			if(temp>temp1)
			{
				temp=temp1;
				pos=j;
			}
		}

		visited[pos]=1;
		cout<<data[i].id<<" "<<data[pos].id<<endl;
		trace1(pos);
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100010;
const int mod=1000000007;
int vis[N];
struct node{
    ll x,y,z,id;
    bool friend operator <(node a,node b){
        return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
    }
}a[N],b[N];
ll cal(int id1,int id2) {
    return (a[id1].x-a[id2].x)*(a[id1].x-a[id2].x)+(a[id1].y-a[id2].y)*(a[id1].y-a[id2].y)+(a[id1].z-a[id2].z)*(a[id1].z-a[id2].z);
}
pair<int,int>ans[N];
int main(){
    ios::sync_with_stdio(false), cin.tie(0);
    int n,m,t,tot=0;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].y>>a[i].z,a[i].id=i;
    sort(a+1,a+1+n);
    for(int i=2;i<=n;i++) {
        if(a[i].x==a[i-1].x&&a[i].y==a[i-1].y) {
            vis[i]=vis[i-1]=1;
            ans[tot++]={a[i-1].id,a[i].id};
            i++;
        }
    }
    int l=0;
    for(int i=1;i<=n;i++) {
        if(!vis[i])b[++l]=a[i];
    }
    memset(vis,0,sizeof vis);
    for(int i=2;i<=l;i++) {
        if(b[i].x==b[i-1].x) {
            vis[i]=vis[i-1]=1;
            ans[tot++]={b[i-1].id,b[i].id};
            i++;
        }
    }
    int r=l;
    l=0;
    for(int i=1;i<=r;i++) {
        if(!vis[i])a[++l]=b[i];
    }
    for(int i=2;i<=l;i+=2) {
        ans[tot++]={a[i-1].id,a[i].id};
    }
    for(int i=0;i<tot;i++) {
        printf("%d %d\n",ans[i].first,ans[i].second);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node{
    long double x,y,z;
    int id;
    bool friend operator <(node a,node b) {
        return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
    }
}a[50001];
unordered_set<int>s;
long double cal(int id1,int id2) {
    return (a[id1].x-a[id2].x)*(a[id1].x-a[id2].x)+(a[id1].y-a[id2].y)*(a[id1].y-a[id2].y)+(a[id1].z-a[id2].z)*(a[id1].z-a[id2].z);
}
int vis[50001];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    cin>>a[i].x>>a[i].y>>a[i].z,a[i].id=i,s.insert(i);
    const double PI = acos(-1);
    double angle = 1.0*(rand()%180)/180*PI;
    for(int i=1;i<=n;i++) {
        a[i].x=a[i].x*cos(angle)-a[i].y*sin(angle);
        a[i].y=a[i].x*sin(angle)+a[i].y*cos(angle);
        //a[i].x=a[i].x*cos(angle)-a[i].z*sin(angle);
        //a[i].z=a[i].x*sin(angle)+a[i].z*cos(angle);
    }
    sort(a+1,a+1+n );
    int cnt=n/2,pos=1;


#include<bits/stdc++.h>
using namespace std;
const  double eps = -1e10;
struct node{
    double x,y,z;
    int id;
    bool friend operator <(node a,node b) {
        return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
    }
}a[50001];
unordered_set<int>s;
double cal(int id1,int id2) {
    return (a[id1].x-a[id2].x)*(a[id1].x-a[id2].x)+(a[id1].y-a[id2].y)*(a[id1].y-a[id2].y)+(a[id1].z-a[id2].z)*(a[id1].z-a[id2].z);
}
int vis[50001];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    cin>>a[i].x>>a[i].y>>a[i].z,a[i].id=i,s.insert(i);
    const double PI = acos(-1);
    double angle = 1.0*(rand()%190)/180*PI;
    for(int i=1;i<=n;i++) {
         double ax=a[i].x,ay=a[i].y,az=a[i].z;
        ax=a[i].x*cos(angle)-a[i].y*sin(angle);
        ay=a[i].x*sin(angle)+a[i].y*cos(angle);
        a[i].x=ax;
        ax=a[i].x*cos(angle)-a[i].z*sin(angle);
        az=a[i].x*sin(angle)+a[i].z*cos(angle);
        a[i].x=ax,a[i].y=ay,a[i].z=az;
    }
    sort(a+1,a+1+n );
    int cnt=n/2,pos=1;
    while(cnt--) {
        while(vis[pos])pos++;
        long long id=0;
         double mn=1e18;
        int tot=2600;
        for(auto i=s.begin();i!=s.end();i++) {
            if(--tot==0)break;
            int nowid=(*i);
            if(nowid==pos)continue;
            if(cal(nowid,pos)<mn) {
                id=nowid;
                mn=cal(nowid,pos);
            }
        }
        s.erase(id);
        s.erase(pos);
        vis[pos]=vis[id]=1;
        printf("%d %d\n",a[pos].id,a[id].id);
    }
}


#include<bits/stdc++.h>
using namespace std;
const long double eps = -1e10;
struct node{
    long double x,y,z;
    int id;
    bool friend operator <(node a,node b) {
        return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
    }
}a[50001];
unordered_set<int>s;
long double cal(int id1,int id2) {
    return (a[id1].x-a[id2].x)*(a[id1].x-a[id2].x)+(a[id1].y-a[id2].y)*(a[id1].y-a[id2].y)+(a[id1].z-a[id2].z)*(a[id1].z-a[id2].z);
}
int vis[50001];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    cin>>a[i].x>>a[i].y>>a[i].z,a[i].id=i,s.insert(i);
    const double PI = acos(-1);
    double angle = 1.0*(rand()%180)/180*PI;
    for(int i=1;i<=n;i++) {
        //a[i].x=a[i].x*cos(angle)-a[i].y*sin(angle);
      //  a[i].y=a[i].x*sin(angle)+a[i].y*cos(angle);
        //a[i].x=a[i].x*cos(angle)-a[i].z*sin(angle);
        //a[i].z=a[i].x*sin(angle)+a[i].z*cos(angle);
    }
    sort(a+1,a+1+n );
    int cnt=n/2,pos=1;
    while(cnt--) {
        while(vis[pos])pos++;
        long long id=0;
        long double mn=1e18;
        int tot=1000;
        for(auto i=s.begin();i!=s.end();i++) {
            if(--tot==0)break;
            int nowid=(*i);
            if(nowid==pos)continue;
            if(cal(nowid,pos)<mn) {
                id=nowid;
                mn=cal(nowid,pos);
            }
        }
        s.erase(id);
        s.erase(pos);
        vis[pos]=vis[id]=1;
        printf("%d %d\n",a[pos].id,a[id].id);
    }
}


#include<bits/stdc++.h>
using namespace std;
struct node{
    long long x,y,z,id;
    bool friend operator <(node a,node b) {
        return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
    }
}a[50001];
unordered_set<int>s;
long long cal(int id1,int id2) {
    return (a[id1].x-a[id2].x)*(a[id1].x-a[id2].x)+(a[id1].y-a[id2].y)*(a[id1].y-a[id2].y)+(a[id1].z-a[id2].z)*(a[id1].z-a[id2].z);
}
int vis[50001];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    scanf("%lld%lld%lld",&a[i].x,&a[i].y,&a[i].z),a[i].id=i,s.insert(i);
    sort(a+1,a+1+n );
    int cnt=n/2,pos=1;
    while(cnt--) {
        while(vis[pos])pos++;
        long long id=0,mn=1e18;
        for(auto i=s.begin();i!=s.end();i++) {
            int nowid=(*i);
            if(nowid==pos)continue;
            if(cal(nowid,pos)<mn) {
                id=nowid;
                mn=cal(nowid,pos);
            }
        }
        s.erase(id);
        s.erase(pos);
        vis[pos]=vis[id]=1;
        printf("%d %d\n",pos,id);
    }
}


#include<bits/stdc++.h>
using namespace std;
const long double eps = -1e10;
struct node{
    long double x,y,z;
    int id;
    bool friend operator <(node a,node b) {
        return make_tuple(a.x,a.y,a.z)<make_tuple(b.x,b.y,b.z);
    }
}a[50001];
unordered_set<int>s;
long double cal(int id1,int id2) {
    return (a[id1].x-a[id2].x)*(a[id1].x-a[id2].x)+(a[id1].y-a[id2].y)*(a[id1].y-a[id2].y)+(a[id1].z-a[id2].z)*(a[id1].z-a[id2].z);
}
int vis[50001];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    cin>>a[i].x>>a[i].y>>a[i].z,a[i].id=i,s.insert(i);
    const double PI = acos(-1);
    double angle = 1.0*(rand()%180)/180*PI;
    for(int i=1;i<=n;i++) {
        long double ax=a[i].x,ay=a[i].y,az=a[i].z;
        ax=a[i].x*cos(angle)-a[i].y*sin(angle);
        ay=a[i].x*sin(angle)+a[i].y*cos(angle);
        a[i].x=ax;
        ax=a[i].x*cos(angle)-a[i].z*sin(angle);
        az=a[i].x*sin(angle)+a[i].z*cos(angle);
        a[i].x=ax,a[i].y=ay,a[i].z=az;
    }
    sort(a+1,a+1+n );
    int cnt=n/2,pos=1;
    while(cnt--) {
        while(vis[pos])pos++;
        long long id=0;
        long double mn=1e18;
        int tot=1000;
        for(auto i=s.begin();i!=s.end();i++) {
            if(--tot==0)break;
            int nowid=(*i);
            if(nowid==pos)continue;
            if(cal(nowid,pos)<mn) {
                id=nowid;
                mn=cal(nowid,pos);
            }
        }
        s.erase(id);
        s.erase(pos);
        vis[pos]=vis[id]=1;
        printf("%d %d\n",a[pos].id,a[id].id);
    }
}