#include <iostream>
using namespace std;
bool isNumIN(int num, int *arr, int len){
for(int i = 0; i < len; i++){
if(num == arr[i]) return true;
}
return false;
}
int main(){
int n = 0, m = 0, temp = 0, zx = 0;
cout << "n = "; cin >> n;
cout << "m = "; cin >> m;
int arr[n][m];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
printf("arr[%d][%d] = ", i, j);
cin >> arr[i][j];
}
}
temp = n + m;
int k[temp];
for(int i = 0; i < temp; i++){
cin >> k[i];
}
cout << endl;
for(int i = 0; i < temp; i++){
if(isNumIN(k[i], *arr, temp)) zx++;
}
if(zx == temp) cout << "DA" << endl; else cout << "NU" << endl;
return 0;
}