Python3 solution
\nclass RLEIterator:\n\n    def __init__(self, encoding: List[int]):\n        self.encoding = encoding\n        self.x = 0\n    def next(self, n: int) -> int:\n
```\nclass RLEIterator:\n\n    def __init__(self, encoding: List[int]):\n        self.encoding = encoding\n        self.x = 0\n    def next(self, n: int) -> int:\n        for i in range(self.x,len(self.encoding)):\n            if i%2 == 0:\n                if self.encoding[i] > 0:\n                    if self.encoding[i] >= n:\n                        self.encoding[i] -= n\n                        return self.encoding[i+1]\n                    else:\n                        n -= self.encoding[i]\n                        self.x = i+2\n        if n > 0:\n            return -1\n```\n**If you like this solution, please upvote for this**
['Python3']