C++ Easy Solution
\nclass OrderedStream {\nprivate:\n    vector<string> data;\n    int i,x;\npublic:\n    OrderedStream(int n) {\n        x=n;\n        data.resize(n,"");\n      
```\nclass OrderedStream {\nprivate:\n    vector<string> data;\n    int i,x;\npublic:\n    OrderedStream(int n) {\n        x=n;\n        data.resize(n,"");\n        i=1;\n    }\n    \n    vector<string> insert(int idKey, string value) {\n        vector<string> ans;\n        data[idKey-1] = value;\n        if(idKey == i){\n            for(int j=i-1; j<x; ++j){\n                if(!data[j].empty()) ans.push_back(data[j]),i++;\n                else break;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']