SP16138 CODGRF - Deconnecting

Description

We define a Beta graph as a set of nodes connected by edges such that one node is connected to another node by at most one edge and no node has an edge starting and ending on itself. Each node has a finite number called 'degree' asssociated with it which is the number of edges connecting that node to the rest of the nodes.

Input Format

The first input line contains one number t — amount of tests (1

Output Format

For each test case output in a separate line the maximum number of nodes that can remain after the above procedure is completed..