Xiaoqiang wants to establish a communication system between currently isolated planets, numbered to . The system will be made out of data links each allowing communication between a pair of planets, and shall form a tree over which any two planets can communicate via some sequence of links.
These data links will be constructed one-by-one. At any point in time, the load of a data link is the number of simple paths across planets and data links which traverse it.
For example, in the scenario above with 8 planets and 5 links constructed, the load on the data link is 6. The 6 simple paths traversing are , , , , , and .
Your task is to answer Xiaoqiang's queries about the load of various data links as the system progressively gets constructed.
Input format
The first line of input consists of two integers and , respectively denoting the number of planets and the number of operations which will occur.
lines of input follow. Each line will be in one of the following two formats:
A : A data link is constructed between planets and . It is guaranteed that and were not previously connected directly or indirectly by data links.
Q : Find the load of the data link between planets and . It is guaranteed that such a data link currently exists.
Output format
Output one line for each query operation - containing a single integer, the load of the requested data link.