#include <iostream>
using namespace std;
const int TEN = 10;
int main() {
int a, b, c, x;
cin >> a >> b >> c >> x;
int copyX = x;
int primaCifra = x;
while (primaCifra >= TEN) {
primaCifra /= TEN;
}
int numarCifre = 0;
while (copyX > 0) {
++numarCifre;
copyX = copyX / TEN; // eliminam ultima cifra
}
int reverseX = 0;
while (x) {
reverseX = reverseX * TEN + x % TEN;
x /= TEN;
}
int primaCifraReverseX = reverseX;
while (primaCifraReverseX >= TEN) {
primaCifraReverseX /= TEN;
}
if ((a == numarCifre) && (b == primaCifra) && (c == primaCifraReverseX)) {
cout << "DA" << endl;
}
else {
cout << "NU" << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IFRFTiA9IDEwOwoKaW50IG1haW4oKSB7CiAgICBpbnQgYSwgYiwgYywgeDsKICAgIGNpbiA+PiBhID4+IGIgPj4gYyA+PiB4OwogICAgaW50IGNvcHlYID0geDsKCiAgICBpbnQgcHJpbWFDaWZyYSA9IHg7CiAgICB3aGlsZSAocHJpbWFDaWZyYSA+PSBURU4pIHsKICAgICAgICBwcmltYUNpZnJhIC89IFRFTjsKICAgIH0KICAgIGludCBudW1hckNpZnJlID0gMDsKICAgIHdoaWxlIChjb3B5WCA+IDApIHsKICAgICAgICArK251bWFyQ2lmcmU7CiAgICAgICAgY29weVggPSBjb3B5WCAvIFRFTjsgLy8gZWxpbWluYW0gdWx0aW1hIGNpZnJhCiAgICB9CiAgICBpbnQgcmV2ZXJzZVggPSAwOwogICAgd2hpbGUgKHgpIHsKICAgICAgICByZXZlcnNlWCA9IHJldmVyc2VYICogVEVOICsgeCAlIFRFTjsKICAgICAgICB4IC89IFRFTjsKICAgIH0KICAgIGludCBwcmltYUNpZnJhUmV2ZXJzZVggPSByZXZlcnNlWDsKICAgIHdoaWxlIChwcmltYUNpZnJhUmV2ZXJzZVggPj0gVEVOKSB7CiAgICAgICAgcHJpbWFDaWZyYVJldmVyc2VYIC89IFRFTjsKICAgIH0KICAgIGlmICgoYSA9PSBudW1hckNpZnJlKSAmJiAoYiA9PSBwcmltYUNpZnJhKSAmJiAoYyA9PSBwcmltYUNpZnJhUmV2ZXJzZVgpKSB7CiAgICAgICAgY291dCA8PCAiREEiIDw8IGVuZGw7CiAgICB9CiAgICBlbHNlIHsKICAgICAgICBjb3V0IDw8ICJOVSIgPDwgZW5kbDsKICAgIH0KICAgIHJldHVybiAwOwp9