Knight Tournament

medium
https://codeforces.com/contest/357/problem/C

Input Format

Check Link

Output Format

Check Link

Constraints

Check Link

Example

Input
4 3
1 2 1
1 3 3
1 4 4
Output
3 1 4 0 
Previous
Beautiful Set Of Points
Next
Balls And Boxes

Related Questions