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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
    static class InputReader {
 
		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar;
		private int snumChars;
		private SpaceCharFilter filter;
 
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
 
		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
 
			int res = 0;
 
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
 
			return res * sgn;
		}
 
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
 
			long res = 0;
 
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
 
			return res * sgn;
		}
 
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
			new Thread(null, new Runnable() {
            public void run() {
                try {
                    Codechef c = new Codechef();
                    c.solve();
                } catch (IOException e1) {
                    e1.printStackTrace();
                } catch (StackOverflowError e) {
                    System.out.println("RTE");
                }
            }
        }, "1", 1 << 26).start();
		//InputReader in = new InputReader(System.in)
	}
	
	int MAX = 1000006;
	int[] d_hash = new int[MAX];
	int[] st = new int[MAX];
	int[] en = new int[MAX];
	
	public void solve()throws IOException {
	   InputReader in = new InputReader(System.in); 
	    int n = in.nextInt();
	    int[] arr = new int[n];
	    Arrays.fill(st,-1);
	    Arrays.fill(en,-1);
	    for(int i=0;i<n;++i){
	        arr[i] = in.nextInt();
	        if(st[arr[i]] == -1)st[arr[i]] = i;
	        en[arr[i]] = i;
	        d_hash[arr[i]]++;
	    }
	    int max = 0,ele = 0,diff = Integer.MAX_VALUE;
	    for(int i = 0;i<n;++i){
	        if(max < d_hash[arr[i]]){
	            max = d_hash[arr[i]];
	            ele = arr[i];
	            diff = en[arr[i]] - st[arr[i]];
	        }
	        if(max == d_hash[arr[i]]){
	            if(diff > (en[arr[i]] - st[arr[i]])){
	                diff = en[arr[i]] - st[arr[i]];
	                ele = arr[i];
	            }
	        }
	    }
	    int l =0,r= 0;
	    while(arr[l]!=ele)++l;
	    d_hash[ele]--;
	    r = l;
	    while(d_hash[ele]!=0){
	        ++r;
	        if(arr[r] == ele){
	            --d_hash[ele];
	        }
	    }
	    System.out.println((l+1)+" "+(r+1));
	}
}