--- Part Two --- All this drifting around in space makes you wonder about the nature of the universe. Does history really repeat itself? You're curious whether the moons will ever return to a previous state. Determine the number of steps that must occur before all of the moons' positions and velocities exactly match a previous point in time. For example, the first example above takes 2772 steps before they exactly match a previous point in time; it eventually returns to the initial state: After 0 steps: pos=, vel= pos=, vel= pos=, vel= pos=, vel= After 2770 steps: pos=, vel= pos=, vel= pos=, vel= pos=, vel= After 2771 steps: pos=, vel= pos=, vel= pos=, vel= pos=, vel= After 2772 steps: pos=, vel= pos=, vel= pos=, vel= pos=, vel= Of course, the universe might last for a very long time before repeating. Here's a copy of the second example from above: This set of initial positions takes 4686774924 steps before it repeats a previous state! Clearly, you might need to find a more efficient way to simulate the universe. How many steps does it take to reach the first state that exactly matches a previous state?