Problem

A truss structure is made of either metal, wood or concrete elements (rod, beams or even cables if the element is in traction). The elements are connected together using revolute joints, that allow free rotation, hence they do not transmit any torque.

This constructions guarantees that the elements are either purely in tractions or purely in compression, with no flexion whatsoever.
This is a very useful mechanical property since few materials can offer strong flexion resistance.

Examples : cranes, wide span roofs, bridges, electric pylons, Alex Moulton bicycle.

The problem:

Assumptions:

An example:


Input data format



Output data format