#include <iostream>
using namespace std;
const int TEN = 10;
const int HUNDRED = 100;
const int THOUSAND = 1000;
int main() {
int n;
cin >> n;
int units = 0, tens = 0, hundreds = 0, thousands = 0;
if (n >= HUNDRED && n < THOUSAND) {
units = n % TEN;
tens = n / TEN % TEN;
hundreds = n / HUNDRED % TEN;
//cout << units << " " << tens << " " << hundreds;
if ((n % TEN == n / HUNDRED) && (n / HUNDRED == n / TEN % TEN)) {
cout << "DA";
} else {
if (units == hundreds && hundreds != tens) {
cout << "APROAPE ";
} else if (units == tens && tens != hundreds) {
cout << "APROAPE ";
} else if (tens == hundreds && tens != units) {
cout << "APROAPE ";
}
}
if ((units != tens) && (tens != hundreds)) {
cout << "NU";
}
}
if (n >= THOUSAND ) {
units = n % TEN;
tens = n / TEN % TEN;
hundreds = n / HUNDRED % TEN;
thousands = n / THOUSAND;
//cout << units << " " << tens << " " << hundreds << " " << thousands;
if ((thousands == hundreds) && (thousands == tens) && (thousands == units)) {
cout << "DA1";
} else {
if ((thousands == hundreds) && (thousands == tens) && (thousands != units)) {
cout << "APROAPE1";
} else if ((thousands == hundreds) && (thousands != tens) && (thousands == units)) {
cout << "APROAPE2";
} else if ((thousands != hundreds) && (thousands == tens) && (thousands == units)) {
cout << "APROAPE3";
} else if ((thousands != hundreds) && (hundreds == tens) && (tens == units)) {
cout << "APROAPE4";
}
}
if ((thousands != hundreds) && (thousands != tens) || (hundreds != tens) && (thousands != units)) {
cout << "NU";
}
}
return 0;
}