#include <iostream>
using namespace std;
int main() {
int n, v[11], w[11];
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
for (int i = 1; i <= n; ++i) {
cin >> w[i];
}
int sort = 1;
while (sort == 1) {
sort = 0;
for (int i = 1; i < n; ++i) {
if (w[i] < w[i + 1]) {
int aux = w[i];
w[i] = w[i + 1];
w[i + 1] = aux;
sort = 1;
}
}
}
int cont = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
if (v[i] == w[j] && v[i] > v[i + 1]) {
++cont;
break;
}
}
}
if (cont != n) {
cout << "NU";
} else {
cout << "DA";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiwgdlsxMV0sIHdbMTFdOwoJY2luID4+IG47Cglmb3IgKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKCQljaW4gPj4gdltpXTsKCX0KCWZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgewoJCWNpbiA+PiB3W2ldOwoJfQoJaW50IHNvcnQgPSAxOwoJd2hpbGUgKHNvcnQgPT0gMSkgewoJCXNvcnQgPSAwOwoJCWZvciAoaW50IGkgPSAxOyBpIDwgbjsgKytpKSB7CgkJCWlmICh3W2ldIDwgd1tpICsgMV0pIHsKCQkJCWludCBhdXggPSB3W2ldOwoJCQkJd1tpXSA9IHdbaSArIDFdOwoJCQkJd1tpICsgMV0gPSBhdXg7CgkJCQlzb3J0ID0gMTsKCQkJfQoJCX0KCX0KCWludCBjb250ID0gMDsKCWZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgewoJCWZvciAoaW50IGogPSAxOyBqIDw9IG47ICsraikgewoJCQlpZiAodltpXSA9PSB3W2pdICYmIHZbaV0gPiB2W2kgKyAxXSkgewoJCQkJKytjb250OwoJCQkJYnJlYWs7CgkJCX0KCQl9Cgl9CglpZiAoY29udCAhPSBuKSB7CgkJY291dCA8PCAiTlUiOwoJfSBlbHNlIHsKCQljb3V0IDw8ICJEQSI7Cgl9CglyZXR1cm4gMDsKfQ==