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.
The first line contains one number *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>), the size of the array.

The second line contains *n* integers *a*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">6</sup>), representing elements of the array.
#!/usr/bin/env python
# 558B_larray.py - Codeforces.com 558B Larray quiz
#
# Copyright (C) 2015 Sergey
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#       http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Help Amr by choosing the smallest subsegment possible.
Input

The first line contains one number n , the size of the array.

The second line contains n integers ai , representing elements of the
array.
Output

Output two integers l,r, the beginning and the end of the subsegment
chosen respectively.

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

# Standard modules
import unittest
import sys
import re
import random
import bisect
import array

# Additional modules


###############################################################################
# Larray Class
###############################################################################


class Larray:
    """ Larray representation """

    def __init__(self, args):
        """ Default constructor """

        self.n = args[0]
        self.list = args[1]

        self.freq = {}
        for i in range(self.n):

            key = self.list[i]
            if key in self.freq:
                (it, len, min, max) = self.freq[key]
                it += 1
                if i < min:
                    min = i
                    len = min - max
                if i > max:
                    max = i
                    len = min - max
                self.freq[key] = (it, len, min, max)
            else:
                self.freq[key] = (1, 0, i, i)

    def calculate(self):
        """ Main calcualtion function of the class """

        values = sorted(self.freq.values())
        result = [values[-1][2]+1, values[-1][3]+1]

        return str(" ".join(map(str, result)))


###############################################################################
# Helping classes
###############################################################################


###############################################################################
# Executable code
###############################################################################


def get_inputs(test_inputs=None):

    it = iter(test_inputs.split("\n")) if test_inputs else None

    def uinput():
        """ Unit-testable input function wrapper """
        if it:
            return next(it)
        else:
            return sys.stdin.readline()

    # Getting string inputs. Place all uinput() calls here
    num = int(uinput())
    nums = list(map(int, uinput().split()))

    # Decoding inputs into a list
    return [num, nums]


def calculate(test_inputs=None):
    """ Base class calculate method wrapper """
    return Larray(get_inputs(test_inputs)).calculate()


###############################################################################
# Unit Tests
###############################################################################


class unitTests(unittest.TestCase):

    def test_sample_tests(self):
        """ Quiz sample tests. Add \n to separate lines """

        # Sample test 1
        test = "5\n1 1 2 2 1"
        self.assertEqual(calculate(test), "1 5")
        self.assertEqual(get_inputs(test)[0], 5)
        self.assertEqual(list(get_inputs(test)[1]), [1, 1, 2, 2, 1])

        # Sample test 2
        test = "5\n1 2 2 3 1"
        self.assertEqual(calculate(test), "2 3")

        # Sample test 3
        test = "6\n1 2 2 1 1 2"
        self.assertEqual(calculate(test), "2 6")

        # Time limit test
        imax = 10000
        test = str(imax)
        test += "\n" + " ".join(map(str, range(imax)))
        self.assertEqual(calculate(test), "10000 10000")

    def test_Larray_class__basic_functions(self):
        """ Larray class basic functions testing """

        # Constructor test
        d = Larray([5, [1, 1, 2, 2, 1]])
        self.assertEqual(d.list[0], 1)
        self.assertEqual(d.freq[1], (3, -4, 0, 4))

if __name__ == "__main__":

    # Avoiding recursion limitaions
    sys.setrecursionlimit(100000)

    if sys.argv[-1] == "-ut":
        unittest.main(argv=[" "])

    # Print the result string
    sys.stdout.write(calculate())
