You have a scale which compares two weights but instead of telling which is heavier or lighter, this scale returns the difference of the weights but will not tell which is heavier. In order for the scale to display an accurate result, the amount of weight on each side must be at least 20g and the difference can not exceed 20g. The scale will not report a result unless there is a weight on each side. If the difference exceeds 20g, the scale will report an error.

Use this scale no more than six times, sort an otherwise identical set of six coins with weights of 20, 21, 22, 23, 24, and 26 grams.

Examples:

Ex 1: If A=30 B=30 then the scale reports 0 (equal)

Ex 2: If A=31 B=29 then the scale reports 2

Ex 3: If A=29 B=31 then the scale reports 2 (undistinguishable from example 2)