solve the problem
 
Magnets