#include <iostream>
using namespace std;
int main()
{
long long int a, b, a1, b1;
short int cmax, ok=0;
cin >> a >> b;
a1=a;
b1=b;
cmax=a1%10;
while (a1!=0)
{
if (a1%10>cmax) cmax=(a1%10);
a1=a1/10;
}
while (b1!=0)
{
if (b1%10==cmax) ok=1;
b1=b1/10;
}
if (ok==1) cout << "DA";
else cout << "NU";
return 0;
}