  We consider the following distributed consensus problem: Each node in a
complete communication network of size $n$ initially holds an \emph{opinion},
which is chosen arbitrarily from a finite set $\Sigma$. The system must
converge toward a consensus state in which all, or almost all nodes, hold the
same opinion. Moreover, this opinion should be \emph{valid}, i.e., it should be
one among those initially present in the system. This condition should be met
even in the presence of an adaptive, malicious adversary who can modify the
opinions of a bounded number of nodes in every round.
  We consider the \emph{3-majority dynamics}: At every round, every node pulls
the opinion from three random neighbors and sets his new opinion to the
majority one (ties are broken arbitrarily). Let $k$ be the number of valid
opinions. We show that, if $k \leqslant n^{\alpha}$, where $\alpha$ is a
suitable positive constant, the 3-majority dynamics converges in time
polynomial in $k$ and $\log n$ with high probability even in the presence of an
adversary who can affect up to $o(\sqrt{n})$ nodes at each round.
  Previously, the convergence of the 3-majority protocol was known for
$|\Sigma| = 2$ only, with an argument that is robust to adversarial errors. On
the other hand, no anonymous, uniform-gossip protocol that is robust to
adversarial errors was known for $|\Sigma| > 2$.
