Unique ShutDown

Time Limit: 1000 ms

Memory Limit: 65535 ms


N computers are connected into a network. The rule is: M different pairs of computers are connected to each other by an link. All connections are two-way, that is, they can be used in both directions. There is always two students playing internet computer games,so Yutou make up his mind to stop them ! That is to say ,he want to shut down the connection between the two boys. Now Yutou want to know if there are no two different sets of link connections that can be destroyed, such that the two boy’s computers cannot connect to each other after shut down only one set of link


The input file consists of several cases. In each case, the first line of the input file contains N, M, A and B (2 <= N <= 100, 1 <= M <= 100, 1 <= A,B <= N, A != B), specifying the number of computers in the network, the number of link connections, and the numbers of the boy’s computers respectively. A case with 4 zeros indicates the end of file. Next M lines describe link connections. For each connection the numbers of the computers it connects are given and the cost of destroying this connection. It is guaranteed that all costs are non-negative integer numbers not exceeding 105, no two computers are directly connected by more than one link, no link connects a computer to itself and initially there is the way to transmit data from one main supercomputer to another.


If there is only one way to shut down, output "UNIQUE" in a single line. In the other case output "AMBIGUOUS".

Sample Input

4 4 1 2
1 2 1
2 4 2
1 3 2
3 4 1
4 4 1 2
1 2 1
2 4 1
1 3 2
3 4 1
0 0 0 0

Sample Output




FeiTeng & ZhangKe