Hello Nabheet,
Thanks for all the help. I guess this is the only solution left. I got the requirement modified because of a loophole I found in the requirement.
So this question still needs another solution, but my problem is solved.
Regards,
Chandni Sharma.