#include <bits/stdc++.h>
using namespace std;
bool verif_prim (int n) {
for (int i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
bool verif_palindrom (int n) {
int cn = n;
int inv = 0;
while (cn) {
inv = inv * 10 + cn % 10;
cn /= 10;
}
if (inv == n)
return true;
else
return false;
}
int main()
{
int n;
cin >> n;
int ok = 0;
while (n) {
int nr;
cin >> nr;
if (verif_palindrom(nr) && verif_prim(nr))
ok = 1;
n--;
}
if (ok)
cout << "DA";
else
cout << "NU";
}