Long-range quantum gate via Rydberg states of atoms in a thermal microwave cavity