task2 - method for finding groups