Given N and S, write a program that decides whether a tree satisfying both of the following conditions exists.
- The tree has N nodes.
- The number of simple paths of length 2 is S.
A simple path is a path that does not pass through the same vertex more than once. The length of a path is the number of edges on it, so a simple path of length 2 joins three distinct vertices.
Direction does not matter in a path. A-B-C and C-B-A count as the same path.