#include <iostream>
using namespace std;
int main()
{
int n, m, cn, cm, i, asf = 0;
cin >> n >> m;
cn = n;
while(cn > 0)
{
cm = m;
while(cm > 0)
{
if(cm%10==cn%10)
{
asf = 1;
break;
}
cm /= 10;
}
cn /= 0;
}
if(asf==0)
cout << "NU";
else
cout << "DA";
return 0;
}