Starting from the mutual information we present a method in order to find a Hamiltonian for a fully connected neural network model with an arbitrary, finite number of neuron states, Q. For small initial correlations between the neurons and the patterns it leads to optimal retrieval performance. For binary neurons, Q = 2, and biased patterns we recover the Hopfield model. For three-state neurons, Q = 3, we find back the recently introduced Blume-Emery-Griffiths network Hamiltonian. We derive its phase diagram and compare it with those of related three-state models. We find that the retrieval region is the largest. (C) 2002 Elsevier Science B.V. All rights reserved.