#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
#define ff first
#define ss second
using namespace std;

int f(vector < int > & v)
{
    int ans = 0;
    for(auto it : v)
    {
        if(it >= ans) ans++;
        else ans--;
    }
    return ans;
}

bool frth(vector < int > & v)
{
    int n = v.size();
    if(n > 500) return false;
    for(int i = 0; i < n; i++) if(v[i] != i + 1) return false;
    return true;
}
int main()
{
    FAST;
    int t; cin >> t;
    int n, k; cin >> n >> k;
    vector < int > v(n);
    for(int i = 0; i < n; i++) cin >> v[i];

    if(frth(v))
    {
//         cout << "entered!\n";
         int a = f(v);
         if(k < 1 || k % 2 != a % 2) return cout << "NE\n", 0;

         vector < int > tr(n);
         int cnt = (n - k);
         for(int j = 0; j < n; j++) tr[j] = v[j];
         vector < int > rev;
         for(int j = n - cnt - 1; j < n; j++) rev.push_back(v[j]);

         int ij = n - 1;
         for(int j = 0; j < rev.size(); j++)
         {
             tr[ij] = rev[j];
             ij--;
         }
        if(f(tr) != k) { while(true) {} }
        cout << "DA\n";
        if(t == 0) return 0;

        for(auto it : tr) cout << it << " ";
        cout << "\n";
//        cout << " --> ";
//        cout << f(tr) << "\n";
        return 0;
    }

    sort(begin(v), end(v));
    int a = f(v);
    sort(begin(v), end(v), greater < int > ());
    int b = f(v);


    if(k >= a)
    {
        if(k > a) return cout << "NE\n", 0;
        sort(begin(v), end(v));
        cout << "DA\n";
        if(t == 0) return 0;
        for(auto it : v) cout << it << " ";
        cout << "\n";
        return 0;
    }


    int c = abs(b) % 2;

    if(abs(k) % 2 != c || k < b || k > a) return cout << "NE\n", 0;

    int tr = f(v);
    int cnt =  0;
    while(tr != k)
    {
        bool b = false;
        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < n; j++)
            {

                swap(v[i], v[j]);
                int tr0 = f(v);
                if(abs(tr - k) > abs(tr0 - k)) { b = true; tr = tr0; break; }
                swap(v[i], v[j]);
            }
            if(b) break;
        }
        if(cnt++ > 1000) break;
    }

    if(cnt > 1000)
    {
        sort(begin(v), end(v));
        tr = f(v);
        cnt =  0;
        while(tr != k)
        {
            bool b = false;
            for(int i = 0; i < n; i++)
            {
                for(int j = 0; j < n; j++)
                {

                    swap(v[i], v[j]);
                    int tr0 = f(v);
                    if(abs(tr - k) > abs(tr0 - k)) { b = true; tr = tr0; break; }
                    swap(v[i], v[j]);
                }
                if(b) break;
            }
            if(cnt++ > 1000) break;
        }
        cout << "DA\n";
        if(t == 0) return 0;
        for(auto it : v) cout << it << " ";
        cout << "\n";
        return 0;
    }

    cout << "DA\n";
    if(t == 0) return 0;
    for(auto it : v) cout << it << " ";
    cout << "\n";

    return 0;
}