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.util.*;
import java.io.*;

public class Main {
    // For fast input output
    // static class FastReader {
    //     BufferedReader br;
    //     StringTokenizer st;

    //     public FastReader() {
    //         try {
    //             br = new BufferedReader(new FileReader("input.txt"));
    //             PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
    //             System.setErr(new PrintStream(new FileOutputStream("error.txt")));
    //             System.setOut(out);
    //         } catch (Exception e) {
    //             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;
    //     }
    // }

    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[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt != 0) {
                        break;
                    }
                    else {
                        continue;
                    }
                }
                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();
        }
    }

    // end of fast i/o code
    static StringBuilder str = new StringBuilder("");

    static class Pair{
        int start;
        int end;

        Pair(int start, int end)
        {
            this.start = start;
            this.end = end;
        }
    }

    public static void main(String[] args) throws IOException{
        Reader reader = new Reader();
        int n = reader.nextInt();
        int[] arr = new int[n];
        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
        for(int i = 0; i < n; i++)
        {
            arr[i] = reader.nextInt();
            if(map.containsKey(arr[i]))
                map.put(arr[i], map.get(arr[i])+1);
            else 
                map.put(arr[i],1);
        }
        HashMap<Integer, Pair> markers = new HashMap<>();
        for(int i = 0; i < n; i++)
        {
            if(!markers.containsKey(arr[i]))
                markers.put(arr[i], new Pair(i,-1));
        }
        for(int i=n-1; i>=0; i--)
        {
            if(markers.get(arr[i]).end == -1)
                markers.put(arr[i], new Pair(markers.get(arr[i]).start, i));
        }
        // for(Map.Entry<Integer, Pair> el: markers.entrySet())
        // {   
        //     System.out.println(el.getKey()+" "+el.getValue().start+" "+el.getValue().end);
        // }
        int maxcount = -1;
        int start, end, minlength;
        start = end = -1;
        minlength = Integer.MAX_VALUE;
        for(Map.Entry<Integer, Integer> el: map.entrySet())
        {
            maxcount = Math.max(maxcount, (int) el.getValue());
        }
        if(maxcount==1)
        {
            System.out.println("1 1");
            return;
        }
        //System.out.println("maxcout "+maxcount);
        for(Map.Entry<Integer, Integer> el: map.entrySet())
        {
            int tempstart, tempend;
            tempend = tempstart = -1;
            if(maxcount == (int) el.getValue())
            {
                tempstart = markers.get((int) el.getKey()).start;
                tempend = markers.get((int) el.getKey()).end;
                // for(int i = 0; i < n; i++)
                // {
                //     if(arr[i] == (int) el.getKey())
                //     {
                //         tempstart = i;
                //         break;
                //     }
                // }
                // for(int i = n-1; i>=0; i--)
                // {
                //     if(arr[i] == (int) el.getKey())
                //     {
                //         tempend = i;
                //         break;
                //     }
                // }
                if((tempend - tempstart +1) < minlength)
                {
                    start = tempstart;
                    end = tempend;
                    minlength = tempend - tempstart + 1;
                }
            }
        }
        System.out.println((start+1)+" "+(end+1));
    }
}