In a vast ocean there are n islands numbered from 1 to n, where each island constitutes a sovereign state.
However, the large number of states is making foreign policy a very complicated matter, so the inhabitants of the islands have decided to simplify things by joining into larger (but fewer) states. This endeavour has turned out to be easier said than done, because there are m pairs of islands whose inhabitants distrust each other and refuse to be part of the same state.
The islanders have sent you q proposals that you should process in order. The ith proposal calls for the state containing island a_i to merge with the state containing island b_i. If the two states contain a pair of islands whose inhabitants distrust each other the proposal should be rejected, but otherwise the proposal should be approved and all the islands in the two states will henceforth be part of the same state.
Please help the islanders figure out which proposals should be rejected and which should be approved!
The input consists of:
Output q lines, where the ith line should be "REFUSE" if the ith proposal should be refused, or "APPROVE" if the ith proposal should be approved.