A hacker compromises one computer in a network. If computer a depends on computer b, then once b is infected, computer a becomes infected after s seconds.
Given the hacked computer and all dependencies, report how many computers become infected and how long until the last infection.
The first line contains T test cases (T≤100). Each test case starts with n, d, and c, followed by d lines with a, b, and s meaning a depends on b.
For each test case, print the number of infected computers and the time of the last infection.