A self-organizing neural network for spatiotemporal patterns is proposed which is a nearest neighbor classifier that stores arbitrary-length spatiotemporal patterns. It has at least three layers. Layer-1 and layer-2 classify input spatial patterns one by one and the algorithm is based on the Carpenter/Grossberg net algorithm. Layer-2 and layer-3 classify and memorize the sequence of the patterns classified in layer-2. The connections between layer-2 and layer-3 are adjusted in both weight and time-delay to deal with spatiotemporal patterns. The features of the proposed neural network are its self-organization, classification, and memorization abilities for spatiotemporal patterns. In addition, it can distinguish different sequences composed of the same patterns such as 'ACT' and 'CAT' by unsupervised learning, and can deal with many sequences of different lengths.