Magnets, from Simon Tatham's Portable Puzzle Collection