  We introduce a novel method for identifying the mass composition of
ultra-high-energy cosmic rays using deep learning. The key idea of the method
is to use a chain of two neural networks. The first network predicts the type
of a primary particle for individual events, while the second infers the mass
composition of an ensemble of events. We apply this method to the Monte-Carlo
data for the Telescope Array Surface Detectors readings, on which it yields an
unprecedented low error of 7% for 4-component approximation. We also discuss
the problems of applying the developed method to the experimental data, and the
way they can be resolved.
