163. Residents vs. Guests
26:7 When there are two mourners with the same level of priority, lots should be drawn. The one who wins says Kaddish at maariv, the one who comes in second gets one Kaddish at shacharis without a lottery, and lots should be drawn for the third Kaddish. If many mourners are present, they should draw lots; whoever wins is excluded from subsequent drawings until everyone has had a chance.
26:8 A resident has priority over a guest, assuming that the guest is no longer in Shiva. If a resident and a guest each have yahrtzeit, the guest is not entitled to any Kaddishes. When up against a resident in Shloshim or a resident in the year of mourning, a guest with yahrtzeit is entitled to one Kaddish. If a resident has yahrtzeit and a resident is in Shloshim, plus there’s a guest with yahrtzeit, the guest still gets one Kaddish. The resident with yahrzeit cannot object because the guest is taking a Kaddish from the one with Shloshim. The resident with yahrzeit says the first Kaddish, the guest with yahrzeit says the second, and the resident in Shloshim says the third.