This text is usually replaced by the Flash movie.

A and B are two interlocking cogwheels having p teeth and q teeth respectively where $$3\leq q\leq p \leq 12$$

One tooth on B is painted red. Find the values of p and q for which this red tooth on B contacts every gap on the cogwheel A as the wheels rotate.