Yes, I know the Yuffie code. She steals up to 48 materia from a prioritized set and when the quest is over she just dumps it on all the characters in whatever empty slots they happen to have. It just fills in empty slots and dumps the rest back into the materia inventory. There's no set order to it, either. Whatever gets stolen first will end up in the first empty slot, etc.