shall apply to— (1) the last taxable year of foreign corporations beginning before January 1, 2018, and each subsequent taxable year of such foreign corporations, and (2) taxable years of United States persons in which or with which such taxable years of foreign corporations end.