102 STAT. 3386 PUBLIC LAW 100-647—NOV. 10,1988 shall include any Federal, State, or local government or agency or instrumentality thereof. "(2) QUALIFIED FARM INDEBTEDNESS.—For purposes of this sec- tion, indebtedness of a taxpayer shall be treated as qualified farm indebtedness if— "(A) such indebtedness was incurred directly in connec- tion with the operation by the taxpayer of the trade or business of farming, and "(B) 50 percent or more of the aggregate grross receipts of the taxpayer for the 3 taxable years preceding the taxable year in which the discharge of such indebtedness occurs is attributable to the trade or business of farming. "(3) AMOUNT EXCLUDED CANNOT EXCEED SUM OF TAX ATTRIBUTES AND BUSINESS AND INVESTMENT ASSETS.— "(A) IN GENERAL,—The amount excluded under subpara- graph (C) of subsection (aXD shall not exceed the sum of— "(i) the adjusted tax attributes of the taxpayer, and "(ii) the aggregate adjusted bases of qualified prop- erty held by the taxpayer as of the beginning of the taxable year following the taxable year in which the discharge occurs. "(B) ADJUSTED TAX ATTRIBUTES.—For purposes of subpara- graph (A), the term 'adjusted tax attributes' means the sum of the tax attributes described in subparagraphs (A), (B), (C), and (E) of subsection (bX2) determined by taking into ac- count $3 for each $1 of the attributes described in subpara- graphs (B) and (E) of subsection (bX2). "(C) QUALIFIED PROPERTY.—For purposes of this para- graph, the term 'qualified property' means any property which is used or is held for use in a trade or business or for the production of income. "(D) COORDINATION WITH INSOLVENCY EXCLUSION.—For purposes of this paragraph, the adjusted basis of any quali- fied property and the amount of the adjusted tax attributes shall be determined after any reduction under subsection (b) by reason of amounts excluded from gross income under subsection (aXIXB)." (5) Paragraph (4) of section 1017(b) of the 1986 Code is amended to read as follows: "(4) SPECIAL RULES FOR QUALIFIED FARM INDEBTEDNESS.— "(A) IN GENERAL.—Any amount which under subsection (bX2XD) of section 108 is to be applied to reduce basis and which is attributable to an amount excluded under subsec- tion (aXIXC) of section 108— "(i) shall be applied only to reduce the basis of quali- fied property held by the taxpayer, and "(ii) shall be applied to reduce the basis of qualified property in the following order: "(I) First the basis of qualified property which is depreciable property. '(II) Second the basis of qualified property which is land used or held for use in the trade or business of farming. "(Ill) Then the basis of other qualified property. "(B) QUALIFIED PROPERTY.—For purposes of this para- graph, the term 'qualified property' has the meaning given to such term by section 108(gX3XC).