(3) a trust is deemed to be a legal person all of the voting shares of the capital stock of which,(a) in the case of a testamentary trust under which one or more beneficiaries are entitled to receive all of the income of the trust that arose before the date of death of one or the last surviving of those beneficiaries (in this subparagraph referred to as the “distribution date”) and under which no other person can, before the distribution date, receive or otherwise obtain the enjoyment of any of the income or capital of the trust,i. are owned at the particular time by such a beneficiary, if that beneficiary’s share of the income or capital of the trust depends on the exercise by any person of, or the failure by any person to exercise, a power to appoint, and if the particular time occurs before the distribution date, or
ii. are owned at the particular time by such a beneficiary in a proportion that the fair market value of the beneficial interest in the trust of the beneficiary is of the fair market value of the beneficial interests in the trust of all the beneficiaries, if subparagraph i does not apply and the particular time occurs before the distribution date;
(b) if a beneficiary’s share of the accumulating income or capital of the trust depends on the exercise by any person of, or the failure by any person to exercise, a power to appoint, are owned at the particular time by the beneficiary, unless subparagraph a applies and the particular time occurs before the distribution date,
(c) in any case in which subparagraph b does not apply, are owned at the particular time by the beneficiary in a proportion that the fair market value of the beneficial interest in the trust of the beneficiary is of the fair market value of all beneficial interests in the trust, unless subparagraph a applies and the particular time occurs before the distribution date, and
(d) in the case of a trust referred to in section 467 of the Taxation Act, are owned at the particular time by the person referred to in that section from whom property of the trust or property for which property of the trust was substituted was directly or indirectly received.