python3 solution
python\nclass OrderedStream:\n\n    def __init__(self, n: int):\n        self.index=0\n        self.lt=[None]*n\n    def insert(self, idKey: int, value: str) ->
```python\nclass OrderedStream:\n\n    def __init__(self, n: int):\n        self.index=0\n        self.lt=[None]*n\n    def insert(self, idKey: int, value: str) -> List[str]:\n        self.lt[idKey-1]=value\n        if idKey!=self.index+1:\n            return []\n        num=0\n        output=list()\n        for ele in self.lt[self.index:]:\n            if ele is None:\n                break\n            output.append(ele)\n            num+=1\n        self.index+=num\n        return output\n```
[]