Nonstationary contact problem of thermoelasticity for bodies heated to different temperatures