using System;
using System.Collections.Generic;


class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     *
     * @param nums int整型一维数组
     * @return int整型二维数组
     */
    public List<List<int>> foundMonotoneStack (List<int> nums) {
        // write code here
        if (nums == null || nums.Count == 0)
            return null;

        List<List<int>> lslsN = new List<List<int>>();
        for (int nIndex = 0; nIndex < nums.Count; nIndex++)
            lslsN.Add(FM(nums, nIndex));
        return lslsN;
    }

    public List<int> FM(List<int> nums, int nCurIndex) {
        // write code here
        List<int> lsN = new List<int>();
        for (int nIndex = nCurIndex - 1; nIndex >= 0; nIndex--) {
            if (nums[nIndex] >= nums[nCurIndex])
                continue;
            lsN.Add(nIndex);
            break;
        }
        if (lsN.Count == 0)
            lsN.Add(-1);
        for (int nIndex = nCurIndex + 1; nIndex < nums.Count; nIndex++) {
            if (nums[nIndex] >= nums[nCurIndex])
                continue;
            lsN.Add(nIndex);
            break;
        }
        if (lsN.Count == 1)
            lsN.Add(-1);
        return lsN;
    }
}