Forming Teams

5

1 votes
Hard
Problem

U.A. high school is conducting a team contest. There can only be a team of 3 members. There are N students in section 1A, but there can only be a single team from 1A. Also, there are students who are friends with each other and some who aren't. So, only those 3 will be willing to form a team if all 3 are friends with each other, ie, 1 is with 2, 2 with 3 and 3 with 1.

Count the total number of possible team triplets.

Class 1A

 

Input Format:

First line contains T, number of test cases.

First line of each test case contains N and M, number of students and number of friend pairs respectively.

Each of the next M lines of each test case contains U and V, denoting that U and V are friends.

 

Output Format:

Output the required answer of each test case in separate lines.

 

Constraints:

1T5

1N104

1M105

1U,VN

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Possible triplets are {1, 2, 3} and {2, 3, 4}.

Editor Image

?