there stream n idkey value pair arrive arbitrary order idKey integer 1 n value string no pair iddesign stream return value increase order id return chunk list value insertion the concatenation chunk result list sort valuesImplement OrderedStream classorderedstreamint n Constructs stream n valuesstre insertint idKey String value Inserts pair idkey value stream return large possible chunk currently insert value appear order ExampleInputOrderedStream insert insert insert insert insert5 3 ccccc 1 aaaaa 2 bbbbb 5 eeeee 4 dddddOutputnull aaaaa bbbbb ccccc ddddd eeeeeexplanation note value order ID aaaaa bbbbb ccccc ddddd eeeeeorderedstream os new OrderedStream5osinsert3 ccccc Inserts 3 ccccc return osinsert1 aaaaa Inserts 1 aaaaa return aaaaaosinsert2 bbbbb Inserts 2 bbbbb return bbbbb cccccosinsert5 eeeee Inserts 5 eeeee return osinsert4 ddddd insert 4 ddddd return ddddd eeeee Concatentating chunk return aaaaa bbbbb ccccc ddddd eeeee aaaaa bbbbb ccccc ddddd eeeee the result order order Constraints1 n 10001 i d nvaluelength 5value consist lowercase lettersEach insert unique idexactly n call insert