A new season of Touhou M-1 Grand Prix is approaching. Girls in Gensokyo cannot wait for participating it. Before the registration, they have to decide which combination they are going to compete as. Every girl in Gensokyo is either a *boke* (funny girl) or a *tsukomi* (straight girl). Every candidate combination is made up of a *boke* and a *tsukomi*. A girl may belong to zero or more candidate combinations, but one can only register as a member of one formal combination. The host of Touhou M-1 Grand Prix hopes that as many formal combinations as possible can participate in this year. Under these constraints, some candidate combinations are actually redundant as it's impossible to register it as a formal one as long as the number of formal combinations has to be maximized. So they want to figure out these redundant combinations and stop considering about them.

There are multiple test cases. Process to the End of File.

The first line of each test case contains three integers: 1 ≤ `X`, `Y` ≤ 20,000 and 1 ≤ `M` ≤ 100,000, where `X` and `Y` are the number of *boke* girls and the number of *tsukomi* girls in Gensokyo, and `M` is the number of candidate combinations.

The following `M` lines are `M` different candidate combinations, one by each line. Each combination is represented by a 6-digit 32-based number, where the first 3 digits represents the index 0 ≤ `B _{i}` <

提交代码