Solution to the reverse groups problem.