Fatal meal - MarisaOJ: Marisa Online Judge

Fatal meal

Time limit: 1000 ms
Memory limit: 256 MB
Marisa is conducting research on $n$ ingredients used in cooking, which can be categorized into two groups, Group $A$ and Group $B$. It is important to note that using two ingredients from different groups in a meal can be fatal. There are $q$ events of two types that Marisa encounters: - `1 u v`: Marisa realizes that ingredient $u$ and ingredient $v$ belong to different groups. - `2 u v`: Marisa questions whether it is safe to use ingredient $u$ and ingredient $v$ together in a meal, based on the information she has gathered so far. Help Marisa answer her questions! ### Input - The first line contains two integers $n,q$. - The next $q$ lines, each line contains three integers represent an event. It is guaranteed that all events are valid, there is no ingredient belong to both groups. ### Output - For each event of type two, print: + `FATAL` if two ingredients belong to different group. + `SAFE` if two ingredients belong to the same group. + `DUNNO` if there is not enough information to conclude. ### Constraints - $1 \le n,q \le 10^5$. - $1 \le u, v \le n$. ### Example Input: ``` 3 5 2 1 2 1 1 2 2 1 2 1 2 3 2 1 3 ``` Output: ``` DUNNO FATAL SAFE ```