
A mathematician carved a sphere into a convex polyhedron. Writing V for the number of vertices, E for the number of edges and F for the number of faces, he knows that every convex polyhedron satisfies V−E+F=2. Carving spheres is his hobby, so when he writes down a record he counts only the vertices and the edges and never the faces.
Given the recorded V and E, find the number of faces of the convex polyhedron.
The first line contains a natural number T. (1≤T≤100)
Each of the next T lines contains two natural numbers V and E separated by a space. (4≤V≤100, 4≤E≤100) V is the number of vertices and E is the number of edges.
For each V and E, print the number of faces of the convex polyhedron on its own line.