## DistTree

Submit solution

Points:
100 (partial)

Time limit:
1.0s

Memory limit:
500M

Authors:

Problem type

Allowed languages

Ada, BrainF***, C, C#, C++, Dart, ~~Go~~, Java, JS, Kotlin, Lua, Pascal, Prolog, Python, Swift, VB

Given a tree, it is wanted to know for each node the sum of the distances from it to the remaining ones.

#### Input

A line containing a single integer (), the amount of nodes in the tree. lines representing the edges of the tree.

#### Output

lineas, the ith line must contain the sum of the distances from all nodes to the one.

#### Input Sample

```
3
1 2
2 3
```

#### Output Sample

```
3
2
3
```

## Comments