Byteasar has always had trouble making decisions. Whenever he travels through Bytetown and there are at least two totally different possible routes between his origin and destination, it takes him ages to settle on one. He recently heard that roadworks are planned in Bytetown, and he is perhaps the only resident glad about it: closing some streets might spare him these agonizing choices.
Bytetown has n junctions connected by m bidirectional streets. Two routes between the same pair of junctions are called totally different if they share no street. Such routes may still pass through common junctions.
As the streets are closed one by one, Byteasar wants to know, for selected pairs of junctions, whether there still exist at least two totally different routes between them (using only the streets that are still open). Write a program that answers his questions.
The first line contains three integers n, m, and z (2≤n≤100000, 1≤m,z≤100000): the number of junctions, the number of streets, and the number of events. The junctions are numbered from 1 to n.
Each of the next m lines contains two integers ai and bi (1≤ai,bi≤n, ai=bi), describing a bidirectional street between junctions ai and bi. Every pair of junctions is joined by at most one street.
Each of the following z lines describes one event as a letter ti and two integers ci and di (ti∈{Z,P}, 1≤ci,di≤n, ci=di). Events are given in chronological order.
For every event of type P, output one line, in the order the events appear in the input. Print TAK (Polish for "yes") if there exist two routes between the given junctions that use disjoint sets of streets, and NIE (Polish for "no") otherwise. At least one event of type P is guaranteed.