Wrong answer in Digital Dictionary

Here is my code: https://ide.codingblocks.com/#/s/22623
The code gives correct output when tested on custom input but gives out a wrong answer on submission. Please verify if the test cases are correct.

for input :
5
a
abc
bc
c
cd
4
a
cb
c
h

Your code produces output as :
a
abc
cb
cbd
c
cd
No suggestions

But the correct output is:
a
abc
No suggestions
c
cb
cd
No suggestions

So the issue seems like there is some problem in construction of your Trie because for the above queries your trie is adding some irrelevant words