Almost Union-Find Accepted

Slow solution, but accepted. Reading the problem definition properly
would've saved a few hours. Consider implementing a faster solution
where moves are not in linear time.