I still don't clearly understand the basic goal you're trying to achieve. Could you give a couple of example rows for each relevant table, and what data you want to end up where?

Does table D contain the "old" data that tables A-C now contain in the new format (with IDs)?
If not, what tables exist in the old format?