You have been hired as TA of Python, 101. Students have turned in their first assignments, but unfortunately there has been a lot of plagiarism. Your college provides a service that runs against all assignments and gives you pairs of assignments that appear to have been copied. Your job as TA, is to identify groups of people who copied from each other or from the same source and call them for questioning:
Input
Any number of lines having pairs of input representing roll number of the student who copied from the next student. For eg.
305641, 305581
305641, 305051
305051, 305581
305051, 305021
305021, 305051
306532, 305111
306532, 205121
305641, 205874
305532, 305182
Output:
205121, 305111, 306532
205874, 305021, 305051, 305581, 305641
305182, 305532
Note: The group of students who cheated should have roll numbers in sorted order as shown above.
Explanation: