(ii) under a qualified first-time homeowner assistance program in connection with the acquisition, construction, or substantial improvement of a principal residence at or before the time of such acquisition or construction, and (iii) the amount of which, when added to all prior qualified down payment assistance under this subparagraph during any taxable year, does not exceed 10 percent of the cost of acquiring, constructing, or substantially improving the principal residence of the designated beneficiary. (B) First-time homeowner The term first-time homeowner means any individual if such individual (and if married, such individual’s spouse) had no present ownership interest in a principal residence during the 3-year period ending on the date of the acquisition, construction, or substantial improvement of the principal residence. (C) Principal residence The term principal residence has the same meaning as when used in section 121. (D) Exception A residence may be taken into account for purposes of this paragraph only if— (i) the residence is not acquired from a person related to the person acquiring such residence (or, if married, such individual’s spouse), and (ii) the basis of the residence in the hands of the person acquiring such residence is not determined— (I) in whole or in part by reference to the adjusted basis of such residence in the hands of the person from whom acquired, or (II) under section 1014(a) (relating to property acquired from a decedent). (E) Construction A residence which is constructed by the taxpayer shall be treated as purchased by the taxpayer on the date the taxpayer first occupies such residence. (F) Special rules relating to marriage (i) Married couples must file joint return If the designated beneficiary is married on the date of the distribution, the distribution shall not be treated as qualified down payment assistance unless the taxpayer and the taxpayer’s spouse file a joint return for the taxable year. (ii) Marital status An individual legally separated from his spouse under a