Encircling exceptional points in non-Hermitian systems with quasidegenerate energy levels