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.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class LargeArray {
	static void solve() {
		// Counter c = new Counter();
		// while(true){
		// String op = next();
		// int n = nextInt();
		//
		// if(op.equals("a"))
		// c.add(n);
		// else if (op.equals("m")){
		// System.out.println(c.getMostCommonCount());
		// }
		// else if (op.equals("d"))
		// c.removeOne(n);
		//
		// System.out.println(c);
		// }

		int n = nextInt();
		int[] a = nextIntArr(n);

		Counter d = new Counter();
		for (int i : a)
			d.add(i);
		int b = d.getMostCommonCount();

		Counter c = new Counter();
		int[] res = new int[]{0, n - 1};
		int r = 0;
		c.add(a[0]);
		for (int l = 0; l < n; l++) {
			while (r < n - 1 && c.getMostCommonCount() < b) {
				r++;
				c.add(a[r]);
			}

//			System.err.println(l + " " + r);
			
			if (c.getMostCommonCount() >= b && r - l < res[1] - res[0])
				res = new int[] { l, r };
			
			c.removeOne(a[l]);
		}
		
		writer.println((res[0] + 1) + " " + (res[1] + 1));
	}

	static class Counter {
		Map<Integer, Integer> count = new HashMap<>();
		TreeMap<Integer, HashSet<Integer>> mostCommon = new TreeMap<>();

		void add(int i) {
			count.merge(i, 1, Integer::sum);

			int cur_cnt = cnt(i);
			if (!mostCommon.containsKey(cur_cnt))
				mostCommon.put(cur_cnt, new HashSet<>());
			mostCommon.get(cur_cnt).add(i);

			cur_cnt--;
			if (cur_cnt > 0) {
				mostCommon.get(cur_cnt).remove(i);
				if (mostCommon.get(cur_cnt).isEmpty())
					mostCommon.remove(cur_cnt);
			}
		}

		void removeOne(int i) {
			int cur_cnt = cnt(i);
			mostCommon.get(cur_cnt).remove(i);

			if (mostCommon.get(cur_cnt).isEmpty())
				mostCommon.remove(cur_cnt);

			cur_cnt--;
			if (cur_cnt >= 0) {
				if (!mostCommon.containsKey(cur_cnt))
					mostCommon.put(cur_cnt, new HashSet<>());
				mostCommon.get(cur_cnt).add(i);
			}

			count.put(i, count.get(i) - 1);
			if (count.get(i) == 0)
				count.remove(i);
		}

		int cnt(int i) {
			return count.getOrDefault(i, 0);
		}

		int getMostCommonCount() {
			return mostCommon.lastKey();
		}

		@Override
		public String toString() {
			return "[ " + count.toString() + " | " + mostCommon.toString() + " ]";
		}
	}

	public static void main(String[] args) {
		solve();
		writer.close();
	}

	static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer tokenizer = new StringTokenizer("");
	static PrintWriter writer = new PrintWriter(System.out);

	static String next() {
		while (!tokenizer.hasMoreTokens())
			try {
				tokenizer = new StringTokenizer(bf.readLine());
			} catch (Exception e) {
				return null;
			}
		return tokenizer.nextToken();
	}

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

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

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

	static int[] nextIntArr(int n) {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = nextInt();
		}

		return a;
	}

}