import java.util.*;
import java.lang.*;
import java.io.*;


class Ideone {
	static int COLORS_EXISTS = 10;
    
    static class Interval {
        int l, r;

        public Interval(int l, int r) {
            this.l = l;
            this.r = r;
        }

        int length() {
            return Math.abs(r - l);
        }
    }

    static Interval getMinAllColorsSubArray(int[] arr) {
        int r = -1; 
        int l = 0;
        HashMap<Integer, Integer> colorsCount = new HashMap<>();
        int differentColorsCount = 0;
        Interval minSubArrayBounds = null;
        
        while (differentColorsCount < COLORS_EXISTS && r < arr.length - 1) {
            r++;
            int rCol = arr[r];
            if (!colorsCount.containsKey(rCol)) {
                differentColorsCount++;
                colorsCount.put(rCol, 1);
            } else {
                colorsCount.merge(rCol, 1, Integer::sum);
            }
            
            while (colorsCount.containsKey(arr[l]) && colorsCount.get(arr[l]) > 1) {
            	colorsCount.merge(arr[l], -1, Integer::sum);
                l++;
            }
            
            if (differentColorsCount == COLORS_EXISTS) {
                Interval subArrayBounds = new Interval(l, r);
                if (minSubArrayBounds == null || minSubArrayBounds.length() > subArrayBounds.length()) {
                    minSubArrayBounds = subArrayBounds;
                }
            }
        }
        
        return minSubArrayBounds;
    }
	
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] input = new int[]{1, 2, 3, 1, 1, 2, 1, 3, 2, 4, 5, 6, 7, 8, 9, 0, 0, 3, 4, 3, 9, 0};
		Interval res = getMinAllColorsSubArray(input);
		System.out.println(res.l + " " + res.r);
	}
}