As @Waylander mentioned in comments, more information is needed to guess A and B.
Since, in the question other products have not been mentioned, I am writing the answers for them with reasoning.
1) Since on reaction of D with soda lime gives benzene, which is a decarboxylating reaction, we guess that D should be benzoic acid or sodium benzoate as you have correctly guessed.
2) Now we see that C on reaction with $\ce{NaOH}+\ce{Br_2}$ gives benzoic acid, and as the mentioned reagents are reagents for iodoform reaction, we conclude that C must have been a methyl ketone and hence acetophenone which also gives 2,4-DNP test.
3) Now D i.e, benzoic acid on heating with $\ce{NH_3}$ gives benzamide which is a condensation reaction in which water condenses out. So, E is benzamide.
4) Benzamide on reaction with $\ce{NaOH}+\ce{Br_2}$ will give aniline, which is the Hoffmann Bromamide degradation reaction. So,F is aniline.
5) Aniline on reaction with $\ce{CHCl_3}+\ce{KOH}$ will give phenyl isocynaide which is the carbylamine reaction.
6) Ozonolysis of phenyl isocyanide gives phenyl isocyanate. So, H is phenyl isocyanate.
Were there any options in the question from where this has been asked? If there were, it would make it easy to guess A and B.
@Waylander
-- a Grignard reaction of $\ce{PhMgBr}$ and, e.g., ethyl formate. $\endgroup$