Solved HAMM problem