#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
ifstream fin("disjoint.in");
ofstream fout("disjoint.out");
int parent[100001];
int root(int x)
{
if(parent[x]==x)
{
return x;
}
return parent[x]=root(parent[x]);
}
void unite(int a,int b)
{
a=root(a),b=root(b);
parent[b]=a;
}
int main()
{
int n,m;
fin >> n >> m;
for(int i=1;i<=n;i++)
{
parent[i]=i,height[i]=1;
}
while(m--)
{
int t,x,y;
fin >> t >> x >> y;
if(t==1)
{
unite(x,y);
}
else
{
fout << (root(x)==root(y) ? "DA" : "NU");
fout << "\n";
}
}
}