

Seats 3,4 and 7,8 are considered as not adjacent to each other.
There is an exceptional case in which seats 3,4 and seat 7,8 are considered to be adjacent and Ninja can split the group from the middle and assign seats to two people on each side.

The first line contains an integer ‘T’ which denotes the number of test cases or queries to be run. Then the test cases are as follows.
The first line of each test case contains two space-separated integers ‘N’, and ‘M’, denoting the number of rows in the cinema hall and the number of reserved seats.
The next ‘M’ line contains two space-separated integers denoting the row number and seat number of reserved seats.
For each test case, return a single integer denoting the maximum number of the four-people groups that can be seated adjacently.
You don’t need to print anything; It has already been taken care of.
1 <= T <= 10
1 <= N <= 10^5
0 <= M <= 10*N
1 <= NON_VACANT[i][0] <= N
1 <= NON_VACANT[i][1] <= 10
Time limit: 1 sec
At first, it can be seen that the number of four-people groups that can be seated in a particular row is independent of all the other rows. So, if we know how to find the number of groups in a particular row, then similarly we can find it for all the other rows and our final answer will be the total number of groups in all rows.
Now, let's see how we can find the number of groups for a particular row:
We can simplify our solution from seat 2 to seat 9.
We will divide the seats into four sections:
Section1 - seat 2, 3
Section2 - seat 4, 5
Section3 - seat 6, 7
Section4 - seat 8, 9

So we will check the vacant sections in each row and calculate the total number of four-group people that can be seated.