Problem: Amr has got a large array of size n. Amr doesn't like large arrays so he intends to make it smaller.

Amr doesn't care about anything in the array except the beauty of it. The beauty of the array is defined to be the maximum number of times that some number occurs in this array. He wants to choose the smallest subsegment of this array such that the beauty of it will be the same as the original array.

Help Amr by choosing the smallest subsegment possible.

Input

The first line contains one number n (1 ≤ n ≤ 105), the size of the array.

The second line contains n integers ai (1 ≤ ai ≤ 106), representing elements of the array.

Output

Output two integers l, r (1 ≤ l ≤ r ≤ n), the beginning and the end of the subsegment chosen respectively.

If there are several possible answers you may output any of them. 

Examples

Input

5
1 1 2 2 1


Output

1 5

Input

5
1 2 2 3 1


Output

2 3

Input

6
1 2 2 1 1 2


Output

1 5

Note

A subsegment B of an array A from l to r is an array of size r - l + 1 where Bi = Al + i - 1 for all 1 ≤ i ≤ r - l + 1

Solution (in JAVA):

Solution:

import java.io.*;
import java.math.*;
import java.util.*;

public class practice {

    // Faster Input...
    static class Reader{
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[200001]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

    public static void debug(int[] ...var) {
        for(int[] row : var) {
            debug(row);
        }
    }

    public static void debug(long[] ...var) {
        for(long[] row : var) {
            debug(row);
        }
    }

    public static void debug(String[] ...var) {
        for(String[] row : var) {
            debug(row);
        }
    }

    public static void debug(double[] ...var) {
        for(double[] row : var) {
            debug(row);
        }
    }

    public static void debug(int ...var) {
        for(int i:var)  System.err.print(i+" ");
        System.err.println();
    }
    public static void debug(String ...var) {
        for(String i:var)  System.err.print(i+" ");
        System.err.println();
    }
    public static void debug(double ...var) {
        for(double i:var)  System.err.print(i+" ");
        System.err.println();
    }
    
    public static void debug(long ...var) {
        for(long i:var)  System.err.print(i+" ");
        System.err.println();
    }

    /*
    public static <T> void debug(T ...varargs) {
        // Warning
        // Heap Pollution might occur
        // this overrides even 1d and 2d array methods as it is an object... 
        // + i am not using object based array like Integer[]
        // I am using int[] so that is a problem as i need Wrapper class as an argument
        for(T val:varargs)  System.err.printf("%s ",val);
        System.err.println();
    }
    */

    private static Reader scan = new Reader();
    public static void main(String args[]) throws Exception{
        //Faster Output...
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        //StringBuilder sb = new StringBuilder();

        //be careful of readLine() -- length of string;

        // Scanner scan = new Scanner(System.in);
        //scan.useDelimiter("");  // for reading character by character

        int n = scan.nextInt();
        int[] a = new int[n+1];
        for(int i=1;i<=n;++i) {
            a[i]=scan.nextInt();
        }
        Map<Integer,Integer> count = new HashMap<>();
        Map<Integer,Integer> first = new HashMap<>();
        Map<Integer,Integer> last = new HashMap<>();
        int maxCount = 1;
        for(int i=1;i<=n;++i) {
            if(count.containsKey(a[i])) {
                int val = count.get(a[i])+1;
                count.put(a[i],val);
                maxCount = Math.max(maxCount,val);
                last.put(a[i],i);
            } else {
                count.put(a[i],1);
                first.put(a[i],i);
                last.put(a[i],i);
            }
        }
        int l=1,r=n;
        for(int i=1;i<=n;++i) {
            if(count.get(a[i])==maxCount) {
                int begin = first.get(a[i]);
                int end = last.get(a[i]);
                if(r-l>end-begin) {
                    r = end;
                    l = begin;  
                }
            }
        }
        out.println(l+" "+r);

        scan.close();
        out.close();
    }
}