3624 - [Apio2008]免费道路

Input

Output

Examples

Input

5 7 2
1 3 0
4 5 1
3 2 0
5 3 1
4 3 0
1 2 1
4 2 1

Output

3 2 0
4 3 0
5 3 1
1 2 1
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题