Self-similarity of hadron production in pp and AA collisions at high energies