  We present a novel approach to search for origins of ultra-high energy cosmic
rays. These particles are likely nuclei that initiate extensive air showers in
the Earth's atmosphere. In large-area observatories, the particle arrival
directions are measured together with their energies and the atmospheric depth
at which their showers maximize. The depths provide rough measures of the
nuclear charges. In a simultaneous fit to all observed cosmic rays we use the
galactic magnetic field as a mass spectrometer and adapt the nuclear charges
such that their extragalactic arrival directions are concentrated in as few
directions as possible. Using different simulated examples we show that, with
the measurements on Earth, reconstruction of extragalactic source directions is
possible. In particular, we show in an astrophysical scenario that source
directions can be reconstructed even within a substantial isotropic background.
