#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int INF=1e9;
const ll LINF=1e18,MOD=1e9+7;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define pb push_back

void PRINT(int x) {cerr << x;}
void PRINT(ll x) {cerr << x;}
void PRINT(double x) {cerr << x;}
void PRINT(char x) {cerr << '\'' << x << '\'';}
void PRINT(string x) {cerr << '\"' << x << '\"';}
void PRINT(bool x) {cerr << (x ? "true" : "false");}

template<typename T,typename V>
void PRINT(pair<T,V>& x){
    cerr<<"{";
    PRINT(x.fi);
    cerr<<",";
    PRINT(x.se);
    cerr<<"}";
}
template<typename T>
void PRINT(T &x){
    int id=0;
    cerr<<"{";
    for(auto _i:x){
        cerr<<(id++ ? "," : "");
        PRINT(_i);
    }
    cerr<<"}";
}
void _PRINT(){
    cerr<<"]\n";
}
template<typename Head,typename... Tail>
void _PRINT(Head h,Tail... t){
    PRINT(h);
    if(sizeof...(t)) cerr<<", ";
    _PRINT(t...);
}

#define Debug(x...) cerr<<"["<<#x<<"]=["; _PRINT(x)

const int mxN=2e5;

int T,N,K;
vector<int> A;

int Probaj(vector<int> B){
    int val=0;
    for(int a:B){
        if(val<=a) val++;
        else val--;
    }
    return val;
}

bool Subtask1(){
    for(int i=1;i<N;i++) if(A[i]!=A[0]) return false;
    return true;
}

bool Subtask2(){
    return N<=8;
}

bool Subtask3(){
    for(int i=0;i<N;i++){
        if(A[i]!=-1 && A[i]!=1) return false;
    }
    return true;
}

bool Subtask4(){
    for(int i=0;i<N;i++) if(A[i]!=i+1) return false;
    return true;
}

void Solve(){
    cin>>T;
    cin>>N>>K;
    A.resize(N);
    for(int i=0;i<N;i++) cin>>A[i];
    if(Subtask4()){
        if((N%2)!=(K%2) || K==0){
            cout<<"NE"<<endl;
        }
        else{
            cout<<"DA"<<endl;
            if(T==0) return;
            vector<int> res;
            for(int i=1;i<=K-1;i++) res.pb(i);
            for(int i=N;i>=K;i--) res.pb(i);
            for(int x:res) cout<<x<<" ";
            cout<<endl;
        }
    }
    else if(Subtask2()){
        vector<int> res;
        do{
            int val=Probaj(A);
            if(val==K){
                res=A;
                break;
            }
        } while(next_permutation(all(A)));
        if(!res.empty()){
            cout<<"DA"<<endl;
            if(T==0) return;
            for(int a:A) cout<<a<<" ";
            cout<<endl;
        }
        else cout<<"NE"<<endl;
    }
    else if(Subtask1()){
        int val=Probaj(A);
        if(val!=K) cout<<"NE"<<endl;
        else{
            cout<<"DA"<<endl;
            if(T==0) return;
            for(int a:A) cout<<a<<" ";
            cout<<endl;
        }
    }
    else if(Subtask3()){
        sort(all(A));
        if(Probaj(A)==K){
            cout<<"DA"<<endl;
            if(T==0) return;
            for(int x:A) cout<<x<<" ";
            cout<<endl;
            return;
        }
        sort(all(A),greater<int>());
        if(Probaj(A)==K){
            cout<<"DA"<<endl;
            if(T==0) return;
            for(int x:A) cout<<x<<" ";
            cout<<endl;
            return;
        }
        cout<<"NE"<<endl;
    }
    else if(N<=5000){
        sort(all(A));
        for(int i=0;i<N;i++){
            vector<int> B=A;
            reverse(B.begin()+i,B.end());
            vector<int> C(B.begin(),B.begin()+i);
            vector<int> D(B.begin()+i,B.end());
            if(Probaj(B)==K){
                cout<<"DA"<<endl;
                if(T==0) return;
                for(int x:B) cout<<x<<" ";
                cout<<endl;
                return;
            }
        }
        cout<<"NE"<<endl;
    }
    else{
        sort(all(A),greater<int>());
        int L=Probaj(A);
        sort(all(A));
        int R=Probaj(A);
        if(!(L<=K && K<=R)){
            cout<<"NE"<<endl;
            return;
        }
        int l=0,r=N-1;
        sort(all(A));
        int res=-1;
        while(l<=r){
            vector<int> B=A;
            reverse(B.begin()+mid,B.end());
            if(Probaj(B)>=K){
                res=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        vector<int> B=A;
        if(res==-1){
            cout<<"NE"<<endl;
            return;
        }
        reverse(B.begin()+res,B.end());
        if(Probaj(B)==K){
            cout<<"DA"<<endl;
            if(T==0) return;
            for(int x:B) cout<<x<<" ";
            cout<<endl;
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; t=1;
    while(t--){
        Solve();
    }
    return 0;
}