B. Mr. Kitayutas Colorful Graph( Codeforces Round #286 (Div

Input

The first line of the input contains space-separated two integers —nandm(2≤n≤100,1≤m≤100), denoting the number of the vertices and the number of the edges, respectively.

The nextmlines contain space-separated three integers —ai,bi(1≤ai<bi≤n) andci(1≤ci≤m). Note that there can be multiple edges between two vertices. However, there are no multiple edges of the same color between two vertices, that is, ifi≠j,(ai,bi,ci)≠(aj,bj,cj).

The next line contains a integer —q(1≤q≤100), denoting the number of the queries.

Then followsqlines, containing space-separated two integers —uiandvi(1≤ui,vi≤n). It is guaranteed thatui≠vi.

,赶快上路吧,不要有一天我们在对方的葬礼上说,要是当时去了就好了。

B. Mr. Kitayutas Colorful Graph( Codeforces Round #286 (Div

相关文章:

你感兴趣的文章:

标签云: