gawk print some special lines

Hi every body,

i have this file example :

TD1
TD2
TD3
.
.
.TDn

<DIE_1>
xxxxxx
<\DIE_1>
<TD1>
information 1
inormation n
<\TD1>
<TDq>
information
<\TD_q>
.
.
.
<DIE_m>
xxxxxx
<\DIE_m>
<TD3>
information 1
inormation n
<\TD3>
<TDP>
information
<\TD_p>

for example i can find TD3 in DIE_n and in DIE_p and this is true for each TD.

i want to print in each new file information of TDn and relative DIE where i find it, for example if TD3 is in DIE_n and DIE_p i will print this two files :

file1
<DIE_n>
xxxxxx
<\DIE_n>
<TD3>
information 1
inormation n
<\TD3>

file 2

<DIE_p>
xxxxxx
<\DIE_p>
<TD3>
information 1
inormation n
<\TD3>

please note that the information in TD3 of each DIE is not similar to the other.

who can use gawk for example to do that, it's hard for me.

many thanks