Pilgrim A performs ifrad. After the Aqabah stoning, the sacrifice mentioned here is voluntary, because in aḥabba refers to this context. He then shaves or shortens.
Pilgrim B performs tamattuʿ. The obligatory hady applies under its conditions; Pilgrim A's optional-sacrifice ruling cannot be transferred to him. Both must still address the stoning, hair ritual, and subsequent visitation tawaf.