class Grid{
class Cel{ List<Animal> animals; }
Cel cels[][];
}
class Animal{
Grid::Cel *cel;
setPos(Coord pos){ cel->remove(this); (cel = grid->celGet(pos))->add(this); }
}
Unless even a single cel-list becomes too long to traverse, in which case you could make the animal point directly to a container object that encapsulates a pointer to itself.