A resin comprising an acylhydrazone bond and having a number average molecular weight of 500 to 500,000, the resin having an acylhydrazone bond equivalent of 100 to 4,000, wherein at least a portion of the acylhydrazine ends are capped with an end-capping agent selected from the group consisting of monoaldehydes, acid anhydrides and acid chlorides, and the resin comprises a repeating unit represented by the following Formula : wherein in Formula , X 1 represents a divalent linking group containing atoms selected from the group consisting of C, H, N, O, S, Si, F, Cl, Br and I and having a molecular weight of 80 to 8,000, in which the number of atoms of the shortest molecular chain that links the carbonyl carbon atoms of two acylhydrazone bonds is 2 to 60; R 3 and R 4 each independently represent a hydrogen group, a methyl group, or a phenyl group; Z represents a group represented by any one of the following Formulas to : wherein in Formula , A 1 represents -CH= or -N=, while the positions of the bonding hands on the aromatic ring are the 2-position and the 6-position, or the 2-position and the 5-position with respect to A 1 , and the aromatic ring may have a methyl group, an ethyl group or a halogen atom at the other positions; in Formula , A 2 represents -CH 2 -, -O-, -S-, or -N(R)- wherein R represents a hydrogen atom, a methyl group, or an ethyl group; in Formula , R 5 represents a hydrogen atom, a methyl group, an ethyl group, a methoxy group, an ethoxy group, a halogen atom, a methylthio group, or an ethylthio group; in Formula , A 3 represents -CH 2 -, -C(CF 3 ) 2 -, -S-, -C(CH 3 ) 2 -, -O-, -SO 2 -, -S(=O)-, -C(=O)-, -C(=O)NH-, or -O-C p H 2p -O- wherein p represents an integer from 2 to 18; and in Formula , 1 represents an integer from 1 to 8. X 1 represents a divalent linking group containing atoms selected from the group consisting of C, H, N, O, S, Si, F, Cl, Br and I and having a molecular weight of 80 to 8,000, in which the number of atoms of the shortest molecular chain that links the carbonyl carbon atoms of two acylhydrazone bonds is 2 to 60; R 3 and R 4 each independently represent a hydrogen group, a methyl group, or a phenyl group; Z represents a group represented by any one of the following Formulas to : wherein in Formula , A 1 represents -CH= or -N=, while the positions of the bonding hands on the aromatic ring are the 2-position and the 6-position, or the 2-position and the 5-position with respect to A 1 , and the aromatic ring may have a methyl group, an ethyl group or a halogen atom at the other positions; in Formula , A 2 represents -CH 2 -, -O-, -S-, or -N(R)- wherein R represents a hydrogen atom, a methyl group, or an ethyl group; in Formula , R 5 represents a hydrogen atom, a methyl group, an ethyl group, a methoxy group, an ethoxy group, a halogen atom, a methylthio group, or an ethylthio group; in Formula , A 3 represents -CH 2 -, -C(CF 3 ) 2 -, -S-, -C(CH 3 ) 2 -, -O-, -SO 2 -, -S(=O)-, -C(=O)-, -C(=O)NH-, or -O-C p H 2p -O- wherein p represents an integer from 2 to 18; and in Formula , 1 represents an integer from 1 to 8. A 1 represents -CH= or -N=, while the positions of the bonding hands on the aromatic ring are the 2-position and the 6-position, or the 2-position and the 5-position with respect to A 1 , and the aromatic ring may have a methyl group, an ethyl group or a halogen atom at the other positions; in Formula , A 2 represents -CH 2 -, -O-, -S-, or -N(R)- wherein R represents a hydrogen atom, a methyl group, or an ethyl group; in Formula , R 5 represents a hydrogen atom, a methyl group, an ethyl group, a methoxy group, an ethoxy group, a halogen atom, a methylthio group, or an ethylthio group; in Formula , A 3 represents -CH 2 -, -C(CF 3 ) 2 -, -S-, -C(CH 3 ) 2 -, -O-, -SO 2 -, -S(=O)-, -C(=O)-, -C(=O)NH-, or -O-C p H 2p -O- wherein p represents an integer from 2 to 18; and in Formula , 1 represents an integer from 1 to 8. <EOS>