题号:NC229647
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
输入描述:
Two integers

in the first line represent the number of points and edges of the graph.
Next

lines, each line contains two integers

, representing an edge
)
.
The next line is an integer

, indicating the number of inquiries.
Next

lines, each line with three integers

, represent an inquiry.
Ensure that there is no self-ring and no double edge.
输出描述:
There are
lines in total, each line contains an integer, and the integer in the
line represents the answer of the
th inquiry.
示例1
输入
复制
4 6
1 2 1
1 3 1
1 4 4
2 3 5
2 4 1
3 4 4
3
1 4 1
1 4 2
1 4 3