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!
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.Input:
3 5
2 1 2
1 1 2
2 1 2
1 2 3
2 1 3
Output:
DUNNO
FATAL
SAFE