The myth goes that X married 27 daughters of Daksha but truly loved only one of them. His other wives complained about his negligent behaviour to Daksha, who cursed him that he would become ugly forever. As a penance, X prayed to lord Shiva to remove the curse, who said that he could not completely remove the curse, but that whenever X lost his beauty completely, he would again gradually gain it back and the cycle would go on.
Who is X and what resulted thus?