There are n people and 2 \cdot m of them already formed pairs. The task is to answer the question if all the remaining unpaired yet n-2 \cdot m people can be connected into pairs.
In the input, exacts pairings for 2 \cdot m people are also given, but this is completely irrelevant to solving the problem. Since a pair consists of 2 different people and one person wants to be a part of exactly one pair, the all remaining n-2 \cdot m people can be connected into pairs if and only if n-2 \cdot m is even. You can also notice that for integer m, n - 2 \cdot m is even if and only if n is even, so we can as well check the parity of n. It follows that the time complexity for answering a single test case is O(1).