HOT GASEOUS ATMOSPHERES IN GALAXY GROUPS AND CLUSTERS ARE BOTH HEATED AND COOLED BY X-RAY CAVITIES