Lorenz attractors play an important role in the modern theory of dynamical systems. The reason is that they are robust, i.e. preserve their chaotic properties under various kinds of perturbations. This means that such attractors can exist in applied models and be observed in experiments. It is known that discrete Lorenz attractors can appear in local and global bifurcations of multidimensional diffeomorphisms. However, to date only partial cases were investigated. In this paper bifurcations of homoclinic and heteroclinic cycles with quadratic tangencies of invariant manifolds are studied. A full list of such bifurcations, leading to the appearance of discrete Lorenz attractors is provided. In addition, with help of numerical techniques, it was proved that if one reverses time in the diffeomorphisms described above, the resulting systems also have such attractors. This result is an important step in the systematic studies of chaos and hyperchaos. a