Case 1: There is only one unfaithful husband in the kingdom.

The wife of this husband knows that every other man in the kingdom is faithful. She knows that there is at least one unfaithful man in the kingdom (Queen Josephine announced this), so the wife deduces that her husband must be unfaithful, and shoots him in the dead of night.

Case 2: There are two unfaithful husbands in the kingdom.

The wife of one of the unfaithful husbands knows that there are two possibilities: either a. her husband is faithful, and there is only one unfaithful man in the kingdom or b. Her husband is unfaithful. (remember, wives know the fidelity of every husband in the kingdom except their own)

If a. were the case, and there is only one unfaithful husband, Case 1 will apply, and the wife will hear a gunshot on the first night.

Because neither wife knows the fidelity of the husband on the first night, no gunshot will be heard on the first night.

After not hearing a gunshot on the first night, the wives can rule out a.,conclude that her husband must be unfaithful, and shoot him on the second night.

Case 3: There are three unfaithful husbands in the kingdom

The wife of one of the unfaithful husbands again knows that there are two possibilities: a. her husband is faithful, and there are two unfaithful men in the kingdom or b. Her husband is unfaithful.

If a. Were the case, and there are only 2 unfaithful husbands, Case 2 will apply, and the wife will hear a gunshot on the second night.

Because no wife knows the fidelity of their husband on the second night, no gunshot will be heard.

After not hearing a gunshot the second night, each of the three wives can rule out option a., and shoot their husbands on the third night.