vertices lie on the circumference of a circle. They are numbered from to in clockwise order.
You want to draw straight line segments between pairs of vertices so that they form a tree. Two edges must not intersect at any point other than a common endpoint.
The distance between two vertices in the tree is the number of edges on the simple path between them.
You are given an array of integers .
Construct a non-crossing tree such that
If no such tree exists, report it.
If several valid trees exist, you may output any of them. The edges may be output in any order.
The edge gives both required distances.
The edges and form a path. Its consecutive distances around the circle are .
A distance of requires each of , , , and to be an edge. A tree on four vertices cannot contain all four of them.
The printed edges form a non-crossing tree. The distances for , , , , and are respectively .
The printed tree is a star centered at vertex . The first and last consecutive pairs have distance , and every other consecutive pair has distance .