Python simple solution
\n\n# Code\n\nclass Solution:\n    def lastVisitedIntegers(self, nums: List[int]) -> List[int]:\n        k , seen , ans =  0 , [] , []\n        for num in nums 
\n\n# Code\n```\nclass Solution:\n    def lastVisitedIntegers(self, nums: List[int]) -> List[int]:\n        k , seen , ans =  0 , [] , []\n        for num in nums : \n            if num >= 0 :\n                k = 0\n                seen.append(num)\n            else:\n                k += 1\n                if k > len(seen):\n                    ans.append(-1)\n                else:\n                    ans.append(seen[-1*k])\n        return ans\n```
['Python3']