1. A content addressable memory (CAM), comprising: a plurality of word memories, each of the word memories including at least a first and a second data piece, each of the data pieces being independently writeable; a plurality of registers, each of the registers corresponding to one of the word memories, and storing information that indicates whether valid or invalid data is stored in the corresponding one of the word memories; and a retrieval result correspondence write-in device, wherein when the first data piece of at least one of the word memories matches a first part of an input retrieval data, the CAM only writes to a second part of the input retrieval data into the second piece of said one word memories as a second data piece, and when none of the word memories contain a first data piece that matches the first part of the input retrieval data, the CAM writes the first and second input retrieval data into a word memory of the word memories having a corresponding register which indicates that data stored in the word memory is invalid.