SP24191 EAGLE1 - Eagle and Dogs
Description
Eagle (AKA Mohamed Ahmed) lives in a city consists of **n** intersections connected by n-1 roads, in a way that can go from any intersection to any other intersection moving along some of these roads.
Every day he starts walking in the city following a simple strategy; if he's at some intersection he **has to** pick one of the roads connected to it at random such that he hasn't walked through it before and walk through it and and if there isn't any, he stops and goes home.
His only problem is that he's afraid of dogs. He doesn't even like seeing dogs. So he's wondering in the worst scenario, how many dogs he'll have to see during his walk until he stops if he starts walking at some intersection. Can you help him?
Input Format
The input starts with an integer **T** (1
Output Format
For each test case print a line containing n integers, the _i_th integer represents the maximum number of dogs Eagle might see if he starts his walk at intersection _i_.