The field-orientation dependent thermal conductivity of the heavy-fermion superconductor UPt 3 was measured down to very low temperatures and under magnetic fields throughout the distinct superconducting phases: B and C phases. In the C phase, a striking twofold oscillation of the thermal conductivity within the basal plane is resolved reflecting the superconducting gap structure with a line of node along the a axis. Moreover, we find an abrupt vanishing of the oscillation across a transition to the B phase, as a clear indication of a change of gap symmetries. We also identify extra two line nodes below and above the equator in both B and C phases. From these results together with the symmetry consideration, the gap function of UPt 3 is determined as a E 1u representation characterized by a combination of two line nodes at the tropics and point nodes at the poles.