Abstract: Weakly cross-linked heteropolymer gels that memorize molecular pairs have been designed and synthesized. The polymer consists of a main monomer component responsible for volume phase transition, methacrylic acid that adsorbs one divalent ion as a pair, and cross-links; The memory of pairing of methacrylic acids within the gels was encoded in the primary sequence of main monomers, methacrylic acids and cross-links within the gels, which was achieved by "imprinting", namely, by synthesizing gels while methacrylic monomers were paired prior to polymerization. The control gels, where methacrylic monomers were randomly distributed, showed frustration in forming pairs, whereas such frustration was completely diminished in the imprinted gels allowing the memory of pair formation