Hm. Could you not just give the objects a tier variable as well as the UID of it's father?
Tier 0 (Grandfather) spawns 1 (Father) which spawns 2 (Son) and so on, sharing a UID or another identifying variable for reference.
You'd find the grandfather by comparing an object's own UID to another and subtracting 2 tiers, father by subtracting 1, child by adding 1, and so on.
Grandfather
Tier = 0
UID = 111
Father
Tier = 1
UID = 111
Son
Tier = 2
UID = 111
Or..y'know, something like that. You could maybe build a string or array storing the UID's of all of an object's parents too.