Start with (0, 0, C), and pour from C to A and from A to B to obtain (0, A, C - A). This is the basic step that must be repeated until B becomes full: (r, B, C - Aq), for some integers r, q 0. At this point, pour from B to C and from A to B: (0, r, C - Aq + B) which is just (0, r, 2C - A(q+1)). This a secondary step. Follow with the basic step until B becomes full, after which apply the secondary step, and so on. Modulo C, the third vessel will successively contain the quantities 0, -A, -2A, -3A, ... Since A and B have been assumed mutually prime, so are A and C. Therefore, all quantities 0, -A, -2A, -3A, ..., -A(C-1) are different modulo C. In other words, the set {0, -A (mod C), -2A (mod C), -3A (mod C), ..., -A(C-1) (mod C)} is just a permutation of the set {0, 1, 2, ..., C-1}.