A Czech town called Kocourkov has a public transport system. It has N bus stops and N−1 two-way roads, and each road joins two different stops. From any stop you reach every other stop by following roads.
Every morning each stop sends out exactly one bus to every other stop, so there are N(N−1) buses in total. A bus halts once at every stop on the route from its origin to its destination.
Every stop needs a timetable that lists all the buses halting there. The buses that begin their route at that stop and the buses that end their route there belong on the timetable too.
You are given a description of the transport system in Kocourkov. For every stop, count the buses that halt there.