Simple Python solution with 2 Heap!
\nclass Solution:\n    def secondGreaterElement(self, nums: List[int]) -> List[int]:\n        res, heap1, heap2 = [-1] * len(nums), [], []\n        for i in ran
```\nclass Solution:\n    def secondGreaterElement(self, nums: List[int]) -> List[int]:\n        res, heap1, heap2 = [-1] * len(nums), [], []\n        for i in range(len(nums)):\n            while heap2 and heap2[0][0] < nums[i]:\n                num, idx = heapq.heappop(heap2)\n                res[idx] = nums[i]\n            while heap1 and heap1[0][0] < nums[i]:\n                heapq.heappush(heap2, (heapq.heappop(heap1)))\n            heapq.heappush(heap1, (nums[i], i))\n        return res\n```
['Python']