A couple of hints that should be enough to send you in the right direction.
Side note: giving the same name to your list a as some of your elements inside that list is going to cause you problems. Why?
Your first challenge is to associate each element of t with the right list of lists in a. Look up MapThread and contemplate.
Your second challenge is to then use that association to accomplish your goal. Look up Map and contemplate creating a “helper function” that might correctly use that.
That should be enough for you to be able to figure this out on your own now and without anyone giving away an answer.