Indirect reciprocity is one of the main principles of evolving cooperation in a social dilemma situation. In reciprocity, a positive score is given to cooperative behaviour while a negative score is given to non-cooperative behaviour, and the dilemma is resolved by selectively cooperating only with those with positive scores. However, many studies have shown that non-cooperation with those who have not cooperated also downgrades one's reputation; they have called this situation the scoring dilemma. To address this dilemma, the notion of justified punishments has been considered. The notion of justified punishment allows good individuals who defect against bad co-players to keep their standing. Despite numerous studies on justified punishment, it is unknown whether this solution leads to a new type of dilemma because reputations may be downgraded when the intent of punishment is not correctly communicated. The dilemma of punishment has so far been rarely analysed, and thus, the complete solution of the mechanism for evolving cooperation using the principle of indirect reciprocity has not been found yet. Here, we identify sufficient conditions to overcome each of the three dilemmas including the dilemma of punishment to maintain stable cooperation by using the framework of evolutionary game theory. This condition includes the principle of detecting free riders, which resolves the social dilemma, the principle of justification, which resolves the scoring dilemma, and the principle of generosity, which resolves the dilemma of punishment. A norm that satisfies these principles can stably maintain social cooperation. Our insights may offer a general assessment principle that applies to a wide range of subjects, from individual actions to national decisions.