If you prefer harder problem, please visit here

思考题 for dw

Childish War (Easy)

Miss. Broken Tail(Wei Duan) is the Math teacher of NFLS Class 8 Junior 3.She is a kind teacher.

Miss. East(Fang Dong) is the Math teacher of NFLS Class 4 Junior 3.She is a kind teacher too.

Tail loves walking around the Xuanwu Lake to relax. So does East.

There are N islands numbered from 1 to N on Xuanwu Lake and there are M bidirectional weighted edges connecting them. It is made sure that the islands are connected and no edge has negative weight.

Tail is located at island S and East is located at island T. They decided to play a childish game.

The game has Q rounds, in each round Tail chooses an positive integer R1 and draw a circle centered at her position with the radius R1. East chooses an positive integer R2 and draw a circle centered at her position with the radius R2.

For each round, print how many islands are included in Tail's circle only and how many islands are included in East's circle only and how many islands are included in both circles.

Example

Input
graph={
[1,2,2],
[2,3,2],
[1,4,2],
[4,3,2],
[1,3,3],
}

S=1 T=3
Query={
[2,1],
[4,4]
}
Output
3 0 1
0 4 0
Explain
Explain
Red for Tail, Blue For East, Green for All

Constriants

Subtask1(50%):N,Q<=1000
Subtask2(50%):N,Q<=100000