#include <bits/stdc++.h>
using namespace std;

int t, n, k;
int a[200010];
int dp[510][510][510];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin >> t;
	cin >> n >> k;
	bool case1 = true;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(i > 0 && a[i] != a[i-1])
			case1 = false;
	}
	if(case1) {
		int curr;
		if(a[0] > n) {
			curr = n;
		}
		else {
			curr = a[0] + (n - a[0]) % 2;
		}
		if(curr == k) {
			cout << "DA\n";
			if(t) {
				for(int i = 0; i < n; i++) {
					cout << a[0] << ' ';
				}
				cout << '\n';
			}
		}
		else {
			cout << "NE\n";
		}
	}
	else if(n <= 8) {
		while(next_permutation(a, a+n)) {
			int curr = 0;
			for(int i = 0; i < n; i++) {
				if(a[i] >= curr)
					curr++;
				else
					curr--;
			}
			if(curr == k) {
				cout << "DA\n";
				if(t) {
					for(int i = 0; i < n; i++) {
						cout << a[i] << ' ';
					}
					cout << '\n';
				}
				return 0;
			}
		}
		cout << "NE\n";
	}

	return 0;
}