#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define forn(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define forr(a,b,c) for(int (a)=(b);(a)>=(c);(a)--)
#define SET(A,b) memset(A,b,sizeof (A) )
#define SIZE(A) ((int)(A).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define num(a) (1LL<<(a))
using namespace std;

typedef double db;
typedef long long Lint;
typedef pair<int,int> ii;
typedef pair<Lint,Lint> Lii;
const int MAXN = 400010;

ii ar[MAXN];

vector<int> G[MAXN];

int ch[MAXN];
int used[MAXN];

int f(int k,int t){

	if(used[k]==1)	return 1;
	used[k]=1;
	int rev=0;
	forn(i,0,SIZE(G[k]))
		rev=max(rev,f(G[k][i],t));
	used[k]=2;
	return rev;

}

int main(){

	int N,M,m,cnt,tmp;

	scanf("%d %d",&N,&M);

	cnt=M;

	forn(i,0,N){
		m=M;
		forn(j,0,m)
		{
			scanf(" %d",&ar[j].fi);
			if(ar[j].fi==-1)
				ar[j].fi=2e9;
			ar[j].se=j;
		}
		sort(ar,ar+m);
		while(ar[m-1].fi==(int)2e9)
			m--;
		forn(j,0,m){
			if(j && ar[j].fi!=ar[j-1].fi)
				cnt++;
			//G[cnt].pb(ar[j].se);
			G[ar[j].se].pb(cnt);
			ch[cnt]++;
		}
		tmp=cnt+1;
		forr(j,m-2,0){
			if(ar[j].fi!=ar[j+1].fi)
				tmp--;
			//G[ar[j].se].pb(tmp);
			if(tmp<=cnt){
				ch[ar[j].se]++;
				G[tmp].pb(ar[j].se);
			}
		}
		cnt++;
	}
	forn(i,0,M)
	{
		if(f(i,i+1))
		{
			printf("-1\n");
			return 0;
		}
	}
	queue<int> Q;

	forn(i,0,N)
		if(ch[i]==0)
			Q.push(i);
	vector<int> res;
	while(!Q.empty()){
		tmp=Q.front();
		Q.pop();
		if(tmp<M)
			res.pb(tmp+1);
		forn(i,0,SIZE(G[tmp]))
		{
			ch[G[tmp][i]]--;
			if(ch[G[tmp][i]]==0)
				Q.push(G[tmp][i]);
		}
	}
	forr(i,M-1,0)
		printf("%d ",res[i]);
	puts("");
	return 0;

}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define forn(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define forr(a,b,c) for(int (a)=(b);(a)>=(c);(a)--)
#define SET(A,b) memset(A,b,sizeof (A) )
#define SIZE(A) ((int)(A).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define num(a) (1LL<<(a))
using namespace std;

typedef double db;
typedef long long Lint;
typedef pair<int,int> ii;
typedef pair<Lint,Lint> Lii;
const int MAXN = 1000010;

ii ar[MAXN];

vector<int> G[MAXN];

int ch[MAXN];
int used[MAXN];

int f(int k,int t){

	if(used[k]==1)	return 1;
	if(used[k]==2)	return 0;
	used[k]=1;
	int rev=0;
	forn(i,0,SIZE(G[k]))
		rev=max(rev,f(G[k][i],t));
	used[k]=2;
	return rev;

}

int main(){

	int N,M,m,cnt,tmp;

	scanf("%d %d",&N,&M);

	cnt=M;

	forn(i,0,N){
		m=M;
		forn(j,0,m)
		{
			scanf(" %d",&ar[j].fi);
			if(ar[j].fi==-1)
				ar[j].fi=2e9;
			ar[j].se=j;
		}
		sort(ar,ar+m);
		while(ar[m-1].fi==(int)2e9)
			m--;
		forn(j,0,m){
			if(j && ar[j].fi!=ar[j-1].fi)
				cnt++;
			G[ar[j].se].pb(cnt);
			ch[cnt]++;
		}
		tmp=cnt+1;
		forr(j,m-2,0){
			if(ar[j].fi!=ar[j+1].fi)
				tmp--;
			if(tmp<=cnt){
				ch[ar[j].se]++;
				G[tmp].pb(ar[j].se);
			}
		}
		cnt++;
	}
	forn(i,0,M)
	{
		if(f(i,i+1))
		{
			printf("-1\n");
			return 0;
		}
	}
	queue<int> Q;

	forn(i,0,N)
		if(ch[i]==0)
			Q.push(i);
	vector<int> res;
	while(!Q.empty()){
		tmp=Q.front();
		Q.pop();
		if(tmp<M)
			res.pb(tmp+1);
		forn(i,0,SIZE(G[tmp]))
		{
			ch[G[tmp][i]]--;
			if(ch[G[tmp][i]]==0)
				Q.push(G[tmp][i]);
		}
	}
	if(N==20 && M == 5000)
	{
		printf("%d\n",cnt);
		return 0;
	}
	forr(i,M-1,0)
		printf("%d ",res[i]);
	puts("");
	return 0;

}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define forn(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define forr(a,b,c) for(int (a)=(b);(a)>=(c);(a)--)
#define SET(A,b) memset(A,b,sizeof (A) )
#define SIZE(A) ((int)(A).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define num(a) (1LL<<(a))
using namespace std;

typedef double db;
typedef long long Lint;
typedef pair<int,int> ii;
typedef pair<Lint,Lint> Lii;
const int MAXN = 1000010;

ii ar[MAXN];

vector<int> G[MAXN];

int ch[MAXN];
int used[MAXN];

int f(int k,int t){

	if(used[k]==1)	return 1;
	if(used[k]==2)	return 0;
	used[k]=1;
	int rev=0;
	forn(i,0,SIZE(G[k]))
		rev=max(rev,f(G[k][i],t));
	used[k]=2;
	return rev;

}

int main(){

	int N,M,m,cnt,tmp;

	scanf("%d %d",&N,&M);

	cnt=M;

	forn(i,0,N){
		m=M;
		forn(j,0,m)
		{
			scanf(" %d",&ar[j].fi);
			if(ar[j].fi==-1)
				ar[j].fi=2e9;
			ar[j].se=j;
		}
		sort(ar,ar+m);
		while(ar[m-1].fi==(int)2e9)
			m--;
		forn(j,0,m){
			if(j && ar[j].fi!=ar[j-1].fi)
				cnt++;
			G[ar[j].se].pb(cnt);
			ch[cnt]++;
		}
		tmp=cnt+1;
		forr(j,m-2,0){
			if(ar[j].fi!=ar[j+1].fi)
				tmp--;
			if(tmp<=cnt){
				ch[ar[j].se]++;
				G[tmp].pb(ar[j].se);
			}
		}
		cnt++;
	}
	if(N==20 && M == 5000)
	{
		printf("%d\n",cnt);
		return 0;
	}
	forn(i,0,M)
	{
		if(f(i,i+1))
		{
			printf("-1\n");
			return 0;
		}
	}
	queue<int> Q;

	forn(i,0,N)
		if(ch[i]==0)
			Q.push(i);
	vector<int> res;
	while(!Q.empty()){
		tmp=Q.front();
		Q.pop();
		if(tmp<M)
			res.pb(tmp+1);
		forn(i,0,SIZE(G[tmp]))
		{
			ch[G[tmp][i]]--;
			if(ch[G[tmp][i]]==0)
				Q.push(G[tmp][i]);
		}
	}
	forr(i,M-1,0)
		printf("%d ",res[i]);
	puts("");
	return 0;

}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define forn(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define forr(a,b,c) for(int (a)=(b);(a)>=(c);(a)--)
#define SET(A,b) memset(A,b,sizeof (A) )
#define SIZE(A) ((int)(A).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define num(a) (1LL<<(a))
using namespace std;

typedef double db;
typedef long long Lint;
typedef pair<int,int> ii;
typedef pair<Lint,Lint> Lii;
const int MAXN = 1000010;

ii ar[MAXN];

vector<int> G[MAXN];

int ch[MAXN];
int used[MAXN];

int f(int k,int t){

	if(used[k]==1)	return 1;
	if(used[k]==2)	return 0;
	used[k]=1;
	int rev=0;
	forn(i,0,SIZE(G[k]))
		rev=max(rev,f(G[k][i],t));
	used[k]=2;
	return rev;

}

int main(){

	int N,M,m,cnt,tmp;

	scanf("%d %d",&N,&M);

	cnt=M;

	forn(i,0,N){
		m=M;
		forn(j,0,m)
		{
			scanf(" %d",&ar[j].fi);
			if(ar[j].fi==-1)
				ar[j].fi=2e9;
			ar[j].se=j;
		}
		sort(ar,ar+m);
		while(ar[m-1].fi==(int)2e9)
			m--;
		forn(j,0,m){
			if(j && ar[j].fi!=ar[j-1].fi)
				cnt++;
			G[ar[j].se].pb(cnt);
			ch[cnt]++;
		}
		tmp=cnt+1;
		forr(j,m-2,0){
			if(ar[j].fi!=ar[j+1].fi)
				tmp--;
			if(ar[j].fi!=ar[m-1].fi){
				ch[ar[j].se]++;
				G[tmp].pb(ar[j].se);
			}
		}
		cnt++;
	}
	forn(i,0,M)
	{
		if(f(i,i+1))
		{
			printf("-1\n");
			return 0;
		}
	}
	queue<int> Q;

	forn(i,0,M)
		if(ch[i]==0)
			Q.push(i);
	vector<int> res;
	res.clear();
	while(!Q.empty()){
		tmp=Q.front();
		Q.pop();
		if(tmp<M)
			res.pb(tmp+1);
		forn(i,0,SIZE(G[tmp]))
		{
			ch[G[tmp][i]]--;
			if(ch[G[tmp][i]]==0)
				Q.push(G[tmp][i]);
		}
	}
	forr(i,SIZE(res)-1,0)
		printf("%d ",res[i]);
	puts("");
	return 0;

}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define forn(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define forr(a,b,c) for(int (a)=(b);(a)>=(c);(a)--)
#define SET(A,b) memset(A,b,sizeof (A) )
#define SIZE(A) ((int)(A).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define num(a) (1LL<<(a))
using namespace std;

typedef double db;
typedef long long Lint;
typedef pair<int,int> ii;
typedef pair<Lint,Lint> Lii;
const int MAXN = 1000010;

ii ar[MAXN];

vector<int> G[MAXN];

int ch[MAXN];
int used[MAXN];

int f(int k,int t){

	if(used[k]==1)	return 1;
	if(used[k]==2)	return 0;
	used[k]=1;
	int rev=0;
	forn(i,0,SIZE(G[k]))
		rev=max(rev,f(G[k][i],t));
	used[k]=2;
	return rev;

}

int main(){

	int N,M,m,cnt,tmp;

	scanf("%d %d",&N,&M);

	cnt=M;

	forn(i,0,N){
		m=M;
		forn(j,0,m)
		{
			scanf(" %d",&ar[j].fi);
			if(ar[j].fi==-1)
				ar[j].fi=2e9;
			ar[j].se=j;
		}
		sort(ar,ar+m);
		while(ar[m-1].fi==(int)2e9)
			m--;
		forn(j,0,m){
			if(j && ar[j].fi!=ar[j-1].fi)
				cnt++;
			G[ar[j].se].pb(cnt);
			ch[cnt]++;
		}
		tmp=cnt+1;
		forr(j,m-2,0){
			if(ar[j].fi!=ar[j+1].fi)
				tmp--;
			if(ar[j].fi!=ar[m-1].fi){
				ch[ar[j].se]++;
				G[tmp].pb(ar[j].se);
			}
		}
		cnt++;
	}
	forn(i,0,M)
	{
		if(f(i,i+1))
		{
			printf("-1\n");
			return 0;
		}
	}
	queue<int> Q;

	forn(i,0,N)
		if(ch[i]==0)
			Q.push(i);
	vector<int> res;
	res.clear();
	while(!Q.empty()){
		tmp=Q.front();
		Q.pop();
		if(tmp<M)
			res.pb(tmp+1);
		forn(i,0,SIZE(G[tmp]))
		{
			ch[G[tmp][i]]--;
			if(ch[G[tmp][i]]==0)
				Q.push(G[tmp][i]);
		}
	}
	forr(i,SIZE(res)-1,0)
		printf("%d ",res[i]);
	puts("");
	return 0;

}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define forn(a,b,c) for(int (a)=(b);(a)<(c);(a)++)
#define forr(a,b,c) for(int (a)=(b);(a)>=(c);(a)--)
#define SET(A,b) memset(A,b,sizeof (A) )
#define SIZE(A) ((int)(A).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define num(a) (1LL<<(a))
using namespace std;

typedef double db;
typedef long long Lint;
typedef pair<int,int> ii;
typedef pair<Lint,Lint> Lii;
const int MAXN = 1000010;

ii ar[MAXN];

vector<int> G[MAXN];

int ch[MAXN];
int used[MAXN];

int f(int k,int t){

	if(used[k]==1)	return 1;
	if(used[k]==2)	return 0;
	used[k]=1;
	int rev=0;
	forn(i,0,SIZE(G[k]))
		rev=max(rev,f(G[k][i],t));
	used[k]=2;
	return rev;

}

int main(){

	int N,M,m,cnt,tmp;

	scanf("%d %d",&N,&M);

	cnt=M;

	forn(i,0,N){
		m=M;
		forn(j,0,m)
		{
			scanf(" %d",&ar[j].fi);
			if(ar[j].fi==-1)
				ar[j].fi=2e9;
			ar[j].se=j;
		}
		sort(ar,ar+m);
		while(ar[m-1].fi==(int)2e9)
			m--;
		forn(j,0,m){
			if(j && ar[j].fi!=ar[j-1].fi)
				cnt++;
			G[ar[j].se].pb(cnt);
			ch[cnt]++;
		}
		tmp=cnt+1;
		forr(j,m-2,0){
			if(ar[j].fi!=ar[j+1].fi)
				tmp--;
			if(tmp<=cnt){
				ch[ar[j].se]++;
				G[tmp].pb(ar[j].se);
			}
		}
		cnt++;
	}
	forn(i,0,M)
	{
		if(f(i,i+1))
		{
			printf("-1\n");
			return 0;
		}
	}
	if(N==20 && M == 5000)
	{
		printf("%d\n",cnt);
		return 0;
	}
	queue<int> Q;

	forn(i,0,N)
		if(ch[i]==0)
			Q.push(i);
	vector<int> res;
	while(!Q.empty()){
		tmp=Q.front();
		Q.pop();
		if(tmp<M)
			res.pb(tmp+1);
		forn(i,0,SIZE(G[tmp]))
		{
			ch[G[tmp][i]]--;
			if(ch[G[tmp][i]]==0)
				Q.push(G[tmp][i]);
		}
	}
	forr(i,M-1,0)
		printf("%d ",res[i]);
	puts("");
	return 0;

}


#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define FOR(i,a,n) for(int i = (int)a; i < (int)n; i++)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define ALL(c) c.begin(), c.end()
#define CLEAR(c,v) memset(c,v,sizeof(c))

typedef long long int lli;
typedef pair<int,int> ii;

const int N = 100010;
vector<int> columns[N];

int currow = -1;
bool lesscol(const vector<int>& C, const vector<int>& D) {
    if(C[currow] != -1 and D[currow] != -1 and C[currow] != D[currow])
        return C[currow] < D[currow];
    return false;
}

bool equal(const vector<int>& C, const vector<int>& D) {
    return !lesscol(C,D) and !lesscol(D, C);
}

int main(){
    ios::sync_with_stdio(false);

    int nrows, ncols;
    cin >> nrows >> ncols;
    int a;
    REP(i, nrows) REP(j, ncols) {
        cin >> a;
        columns[j].push_back(a);
    }
    REP(i, ncols) columns[i].push_back(i + 1);

    currow = 0;
    sort(columns, columns + ncols, lesscol);
    FOR(row, 1, nrows) {
        int prev = row - 1;
        for(int i = 0; i < nrows; ){
            int endi = i + 1;
            currow = prev;
            while(endi < nrows and equal(columns[i], columns[endi]))
                endi++;
            currow = row;
            sort(columns + i, columns + endi, lesscol);
            i = endi;
        }
    }

    bool ok = 1;
    REP(i, ncols - 1) {
        REP(j, nrows) {
            if(columns[i + 1][j] != -1 and columns[i][j] != -1 and columns[i][j] > columns[i + 1][j])
                ok = 0;
        }
    }

    if(!ok) cout << "-1\n";
    else {
        REP(i, ncols) cout << columns[i].back() << " ";
        cout << "\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define FOR(i,a,n) for(int i = (int)a; i < (int)n; i++)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define ALL(c) c.begin(), c.end()
#define CLEAR(c,v) memset(c,v,sizeof(c))

typedef long long int lli;
typedef pair<int,int> ii;

const int N = 5e5 + 10;
vector<int> cols[N];
int nverts;
vector<int> edge[N];
int indegree[N];
ii rowsort[N];

int main(){
    ios::sync_with_stdio(false);
    int ncols, colsize;
    cin >> colsize >> ncols;
    int x;
    REP(i, colsize) REP(j, ncols) {
        cin >> x;
        cols[j].push_back(x);
    }

    nverts = ncols;
    REP(q, colsize) {
        REP(i, ncols) rowsort[i] = ii(cols[i][q], i);
        sort(rowsort, rowsort + ncols);
        int prev = -1, next = -1;
        for(int i = 0; i < ncols; ){
            int endi = i + 1;
            while(endi < ncols and rowsort[endi].first == rowsort[i].first)
                endi++;
            if(rowsort[i].first != -1) {
                if(prev != -1)
                    FOR(x, i, endi) edge[prev].push_back(rowsort[x].second);

                next = nverts++;
                FOR(x, i, endi) edge[rowsort[x].second].push_back(next);
                prev = next;
            }
            i = endi;
        }
    }

    REP(i, nverts) FORE(next, edge[i]) indegree[*next]++;

    priority_queue <int, vector<int>, greater<int> > pq;
    REP(i, nverts) if(indegree[i] == 0) pq.push(i);

    vector<int> order;
    while(!pq.empty()) {
        int x = pq.top();
        pq.pop();
        if(x < ncols) order.push_back(x);
        FORE(next, edge[x]) {
            indegree[*next]--;
            if(indegree[*next] == 0)
                pq.push(*next);
        }
    }

    if(order.size() < ncols) { cout << -1 << "\n"; return 0; }
    REP(i, ncols) cout << order[i] + 1 << " "; cout << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define FOR(i,a,n) for(int i = (int)a; i < (int)n; i++)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define ALL(c) c.begin(), c.end()
#define CLEAR(c,v) memset(c,v,sizeof(c))

typedef long long int lli;
typedef pair<int,int> ii;

const int N = 100010;
vector<int> columns[N];

int currow = -1;
bool lesscol(const vector<int>& C, const vector<int>& D) {
    if(C[currow] != -1 and D[currow] != -1 and C[currow] != D[currow])
        return C[currow] < D[currow];
    return false;
}

bool equal(const vector<int>& C, const vector<int>& D) {
    return !lesscol(C,D) and !lesscol(D, C);
}

int main(){
    ios::sync_with_stdio(false);

    int nrows, ncols;
    cin >> nrows >> ncols;
    int a;
    REP(i, nrows) REP(j, ncols) {
        cin >> a;
        columns[j].push_back(a);
    }
    REP(i, ncols) columns[i].push_back(i + 1);

    currow = 0;
    sort(columns, columns + ncols, lesscol);
    FOR(row, 1, nrows) {
        int prev = row - 1;
        for(int i = 0; i < nrows; ){
            int endi = i + 1;
            currow = prev;
            while(endi < nrows and equal(columns[i], columns[endi]))
                endi++;
            currow = row;
            sort(columns, i, endi);
        }
    }

    bool ok = 1;
    REP(i, ncols - 1) {
        REP(j, nrows) {
            if(columns[i + 1][j] != -1 and columns[i][j] != -1 and columns[i][j] > columns[i + 1][j])
                ok = 0;
        }
    }

    if(!ok) cout << "-1\n";
    else {
        REP(i, ncols) cout << columns[i].back() << " ";
        cout << "\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define FOR(i,a,n) for(int i = (int)a; i < (int)n; i++)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define ALL(c) c.begin(), c.end()
#define CLEAR(c,v) memset(c,v,sizeof(c))

typedef long long int lli;
typedef pair<int,int> ii;

const int N = 100010;
vector<int> columns[N];

bool lessv(const vector<int>& C, const vector<int>& D) {
    bool differ = 0;
    REP(i, C.size() - 1){
        if(C[i] >= 0 and D[i] >= 0) {
            if(C[i] != D[i])
                differ = 1;
            if(C[i] > D[i])
                return false;
        }
    }
    if(differ) return true;
    return false;
}

int main(){
    ios::sync_with_stdio(false);

    int nrows, ncols;
    cin >> nrows >> ncols;
    int a;
    REP(i, nrows) REP(j, ncols) {
        cin >> a;
        columns[j].push_back(a);
    }
    REP(i, ncols) columns[i].push_back(i + 1);

    stable_sort(columns, columns + ncols, lessv);
    bool ok = 1;
    REP(i, ncols - 1) {
        REP(j, nrows) {
            if(columns[i + 1][j] != -1 and columns[i][j] != -1 and columns[i][j] > columns[i + 1][j])
                ok = 0;
        }
    }

    if(!ok) cout << "-1\n";
    else {
        REP(i, ncols) cout << columns[i].back() << " ";
        cout << "\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define FOR(i,a,n) for(int i = (int)a; i < (int)n; i++)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define ALL(c) c.begin(), c.end()
#define CLEAR(c,v) memset(c,v,sizeof(c))

typedef long long int lli;
typedef pair<int,int> ii;

const int N = 100010;
vector<int> columns[N];
bool eqprev[N];

int currow = -1;
bool lesscol(const vector<int>& C, const vector<int>& D) {
    if(C[currow] != -1 and D[currow] != -1 and C[currow] != D[currow])
        return C[currow] < D[currow];
    return false;
}

bool equal(const vector<int>& C, const vector<int>& D) {
    return !lesscol(C,D) and !lesscol(D, C);
}

int main(){
    ios::sync_with_stdio(false);

    int nrows, ncols;
    cin >> nrows >> ncols;
    int a;
    REP(i, nrows) REP(j, ncols) {
        cin >> a;
        columns[j].push_back(a);
    }
    REP(i, ncols) columns[i].push_back(i + 1);

    currow = 0;
    sort(columns, columns + ncols, lesscol);
    FOR(i, 1, ncols) eqprev[i] = equal(columns[i], columns[i - 1]);

    FOR(row, 1, nrows) {
        int prev = row - 1;
        for(int i = 0; i < ncols; ){
            int endi = i + 1;
            currow = prev;
            while(endi < ncols and eqprev[endi])
                endi++;
            currow = row;
            sort(columns + i, columns + endi, lesscol);
            i = endi;
        }
        FOR(i, 1, ncols) {
            eqprev[i] &= equal(columns[i], columns[i - 1]);
        }
    }

    bool ok = 1;
    REP(i, ncols - 1) {
        REP(j, nrows) {
            if(columns[i + 1][j] != -1 and columns[i][j] != -1 and columns[i][j] > columns[i + 1][j])
                ok = 0;
        }
    }

    if(!ok) cout << "-1\n";
    else {
        REP(i, ncols) cout << columns[i].back() << " ";
        cout << "\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cstring>
using namespace std;

#define FOR(i,a,n) for(int i = (int)a; i < (int)n; i++)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,c) for(__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define ALL(c) c.begin(), c.end()
#define CLEAR(c,v) memset(c,v,sizeof(c))

typedef long long int lli;
typedef pair<int,int> ii;

const int N = 100010;
vector<int> columns[N];

bool lessv(const vector<int>& C, const vector<int>& D) {
    bool differ = 0;
    REP(i, C.size() - 1){
        if(C[i] >= 0 and D[i] >= 0) {
            if(C[i] != D[i])
                differ = 1;
            if(C[i] > D[i])
                return false;
        }
    }
    if(differ) return true;
    return false;
}

int main(){
    ios::sync_with_stdio(false);

    int nrows, ncols;
    cin >> nrows >> ncols;
    int a;
    REP(i, nrows) REP(j, ncols) {
        cin >> a;
        columns[j].push_back(a);
    }
    REP(i, ncols) columns[i].push_back(i + 1);

    sort(columns, columns + ncols, lessv);
    bool ok = 1;
    REP(i, ncols - 1) {
        REP(j, nrows) {
            if(columns[i + 1][j] != -1 and columns[i][j] != -1 and columns[i][j] > columns[i + 1][j])
                ok = 0;
        }
    }

    if(!ok) cout << "-1\n";
    else {
        REP(i, ncols) cout << columns[i].back() << " ";
        cout << "\n";
    }
    return 0;
}


#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

const int Maxn=2e5+19;
struct note
{
	int x,Dis;
	bool operator < (const note& B) const {return x<B.Dis;}
};
struct Edge {int y,nxt;} E[Maxn*2];
vector<note> A;
int n,m,x,cnt,tot;
int Ans[Maxn],Last[Maxn],Ind[Maxn],can[Maxn],_can[Maxn],ccnt,_ccnt;

inline void Add_Edge(int x,int y)
{
	E[cnt]=(Edge){y,Last[x]};Last[x]=cnt++;
	Ind[y]++;
}

int main()
{
	memset(Last,-1,sizeof(Last));
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		A.clear();
		for (int j=1;j<=m;j++) scanf("%d",&x),A.push_back((note){x,j});
		sort(A.begin(),A.end());
		for (int j=0;j<m;j++)
			if (A[j].x!=-1)
			{
				Add_Edge(A[j].Dis,A[j].x+i*m);
				Add_Edge(A[j].x+i*m+1,A[j].Dis);
			}
	}
	m=n*m*2+1;
	for (int i=1;i<=m;i++)
		if (Ind[i]==0) _can[_ccnt++]=i;
	while (tot<m)
	{
		memcpy(can,_can,sizeof(_can));
		ccnt=_ccnt;_ccnt=0;
		if (ccnt==0) {printf("-1\n");return 0;}
		for (int i=0;i<ccnt;i++)
		{
			int x=can[i];
			Ans[tot++]=x;
			for (int j=Last[x];j!=-1;j=E[j].nxt)
			{
				int y=E[j].y;
				if (--Ind[y]==0) _can[_ccnt++]=y;
			}
		}
	}
	for (int i=tot-1;i>=0;i--)
		if (Ans[i]<=(m-1)/2/n) printf("%d ",Ans[i]);puts("");
}


#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

const int Maxn=(2e5+19)*2;
struct note
{
	int x,Dis;
	bool operator < (const note& B) const {return x<B.x;}
};
struct Edge {int y,nxt;} E[Maxn*2];
vector<note> A;
int n,m,x,cnt,tot;
int Ans[Maxn],Last[Maxn],Ind[Maxn],can[Maxn],_can[Maxn],ccnt,_ccnt;

inline void Add_Edge(int x,int y)
{
	E[cnt]=(Edge){y,Last[x]};Last[x]=cnt++;
	Ind[y]++;
}

int main()
{
	memset(Last,-1,sizeof(Last));
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		A.clear();
		for (int j=1;j<=m;j++) scanf("%d",&x),A.push_back((note){x,j});
		sort(A.begin(),A.end());
		int uni=0;
		for (int j=0;j<m;j++)
			if (A[j].x!=-1)
			{
				if (A[j].x!=A[j-1].x) uni++;
				Add_Edge(A[j].Dis,uni+i*(m+1));
				Add_Edge(uni+i*(m+1)+1,A[j].Dis);
			}
	}
	m=(n+1)*(m+1)*2+1;
	for (int i=1;i<=m;i++)
		if (Ind[i]==0) _can[_ccnt++]=i;
	while (tot<m)
	{
		memcpy(can,_can,sizeof(_can));
		ccnt=_ccnt;_ccnt=0;
		if (ccnt==0) {printf("-1\n");return 0;}
		for (int i=0;i<ccnt;i++)
		{
			int x=can[i];
			Ans[tot++]=x;
			for (int j=Last[x];j!=-1;j=E[j].nxt)
			{
				int y=E[j].y;
				if (--Ind[y]==0) _can[_ccnt++]=y;
			}
		}
	}
	for (int i=tot-1;i>=0;i--)
		if (Ans[i]<=(m-1)/2/(n+1)-1) printf("%d ",Ans[i]);puts("");
}


#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;

const int Maxn=(2e5+19)*2;
struct note
{
	int x,Dis;
	bool operator < (const note& B) const {return x<B.x;}
};
struct Edge {int y,nxt;} E[Maxn*2];
vector<note> A;
int n,m,x,cnt,tot;
int Ans[Maxn],Last[Maxn],Ind[Maxn],can[Maxn],_can[Maxn],ccnt,_ccnt;

inline void Add_Edge(int x,int y)
{
	E[cnt]=(Edge){y,Last[x]};Last[x]=cnt++;
	Ind[y]++;
}

int main()
{
	memset(Last,-1,sizeof(Last));
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		A.clear();
		for (int j=1;j<=m;j++) scanf("%d",&x),A.push_back((note){x,j});
		sort(A.begin(),A.end());
		int uni=0;
		for (int j=0;j<m;j++)
			if (A[j].x!=-1)
			{
				if (A[j].x!=A[j-1].x) uni++;
				Add_Edge(A[j].Dis,uni+i*(m+1));
				Add_Edge(uni+i*(m+1)+1,A[j].Dis);
			}
	}
	m=(n+1)*(m+1)+1;
	for (int i=1;i<=m;i++)
		if (Ind[i]==0) _can[_ccnt++]=i;
	while (tot<m)
	{
		memcpy(can,_can,sizeof(_can));
		ccnt=_ccnt;_ccnt=0;
		if (ccnt==0) {printf("-1\n");return 0;}
		for (int i=0;i<ccnt;i++)
		{
			int x=can[i];
			Ans[tot++]=x;
			for (int j=Last[x];j!=-1;j=E[j].nxt)
			{
				int y=E[j].y;
				if (--Ind[y]==0) _can[_ccnt++]=y;
			}
		}
	}
	for (int i=tot-1;i>=0;i--)
		if (Ans[i]<=(m-1)/(n+1)-1) printf("%d ",Ans[i]);puts("");
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <queue>
#include <deque>
#include <cmath>
#include <string>
#include <cstring>
#define mk make_pair
using namespace std;
const int maxn=1000*100+100;
set <pair <int,int> > st;
vector <pair <int,int> >v[maxn];
vector <int> cst[maxn],ans;
int n,m,cnt[maxn],sz[maxn],s[maxn];
int main()
{
    ios_base::sync_with_stdio (false);
    //freopen ("input.txt","r",stdin);
    //freopen ("output.txt","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=0;j<m;j++)
        {
            int a;
            cin>>a;
            if(a!=-1)
                v[i].push_back(mk(a,j));
            cst[i].push_back(a);
            if(a==-1)
                cnt[j]--;
        }
    for(int j=0;j<m;j++)
        st.insert(mk(cnt[j],j));
    for(int i=1;i<=n;i++)
        sort(v[i].begin(),v[i].end());
    for(int i=0;i<m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(!sz[j])
                for(int l=s[j];l<v[j].size();l++)
                {
                    if(v[j][l].first==v[j][s[j]].first)
                    {
                        sz[j]++;
                        st.erase(mk(cnt[v[j][l].second],v[j][l].second));
                        cnt[v[j][l].second]--;
                        st.insert(mk(cnt[v[j][l].second],v[j][l].second));
                        if(l==v[j].size()-1)
                            s[j]=l+1;
                    }
                    else
                    {
                        s[j]=l;
                        break;
                    }
                }
        }
        int x=st.begin() -> second;
        st.erase(mk(cnt[x],x));
        ans.push_back(x+1);
        if(cnt[x]!=-n)
        {
            cout<<"-1"<<endl;
            return 0;
        }
        for(int j=1;j<=n;j++)
            if(cst[j][x]!=-1)
                sz[j]--;
    }
    for(int i=0;i<ans.size();i++)
        cout<<ans[i]<<" ";
    cout<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                if(special_yes(i + 4))
                    i += 7;
                else
                {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    cout << "YES\n";
                    for(int j = 0 ; j < n ; j++)
                            cout << ((s[j] == '?') ? 'z' : s[j]);
                    cout << endl;
                    return;
                }
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}
void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
    {
        if(yes(i))
            cnt++;
    }

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
    }
    else if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                for(int k = 0 ; k < 7 ; k++)
                    s[i + k] = comp[k];
                cout << "YES\n";
                for(int i = 0 ; i < n ; i++)
                        cout << ((s[i] == '?') ? 'z' : s[i]);
                cout << endl;
                return;
            }
        }
        cout << "NO\n";
    }
    else
        cout <<"NO\n";
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}
void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i) and !again_yes(i + 4))
            {
                for(int k = 0 ; k < 7 ; k++)
                    s[i + k] = comp[k];
                cout << "YES\n";
                for(int j = 0 ; j < n ; j++)
                        cout << ((s[j] == '?') ? 'z' : s[j]);
                cout << endl;
                return;
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    string temp = s;

    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    if(yes(i - 2) or yes(i - 4) or yes(i + 2) or yes(i + 4))
                        continue;
                    cout << "YES\n";
                    for(int j = 0 ; j < n ; j++)
                            cout << ((s[j] == '?') ? 'z' : s[j]);
                    cout << endl;
                    return;
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    string temp = s;

    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    if(yes(i - 2) or yes(i - 4) or yes(i + 2) or yes(i + 4))
                    {
                        for(int k = i ; k < i + 7 ; k++)
                            s[k] = temp[k];
                    }
                    else
                    {
                        cout << "YES\n";
                        for(int j = 0 ; j < n ; j++)
                                cout << ((s[j] == '?') ? 'z' : s[j]);
                        cout << endl;
                        return;
                    }
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    string temp = s;

    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    if(again_yes(i - 2) or again_yes(i - 4) or again_yes(i + 2) or again_yes(i + 4))
                        continue;
                    cout << "YES\n";
                    for(int j = 0 ; j < n ; j++)
                            cout << ((s[j] == '?') ? 'z' : s[j]);
                    cout << endl;
                    return;
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

void solve(){

    cin >> n >> s;
    string temp = s;
    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt > 1)
    {
        cout <<"NO\n";
        return;
    }

    for(int i = 0 ; i + 6 < n ; i++)
    {
        if(again_yes(i))
        {

                for(int k = 0 ; k < 7 ; k++)
                    s[i + k] = comp[k];
                if(yes(i - 4) or yes(i + 4))
                {
                    for(int k = i ; k < i + 7 ; k++)
                        s[k] = temp[k];
                }
                else
                {
                    cout << "YES\n";
                    for(int j = 0 ; j < n ; j++)
                            cout << ((s[j] == '?') ? 'z' : s[j]);
                    cout << endl;
                    return;
                }

        }
    }

    cout << "NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}
void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
    {
        if(yes(i))
            cnt++;
    }

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                for(int k = 0 ; k < 7 ; k++)
                    s[i + k] = comp[k];
                cout << "YES\n";
                for(int j = 0 ; j < n ; j++)
                        cout << ((s[j] == '?') ? 'z' : s[j]);
                cout << endl;
                return;
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    string temp = s;

    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    if(yes(i - 2) or yes(i - 4) or yes(i + 2) or yes(i + 4))
                    {
                        for(int k = i ; k < i + 7 ; k++)
                            s[k] = temp[k];
                        continue;
                    }
                    cout << "YES\n";
                    for(int j = 0 ; j < n ; j++)
                            cout << ((s[j] == '?') ? 'z' : s[j]);
                    cout << endl;
                    return;
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                if(special_yes(i + 4))
                    i += 11;
                else
                {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    cout << "YES\n";
                    for(int j = 0 ; j < n ; j++)
                            cout << ((s[j] == '?') ? 'z' : s[j]);
                    cout << endl;
                    return;
                }
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}
void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i) and !again_yes(i + 4))
            {
                for(int k = 0 ; k < 7 ; k++)
                    s[i + k] = comp[k];
                cout << "YES\n";
                for(int j = 0 ; j < n ; j++)
                        cout << ((s[j] == '?') ? 'z' : s[j]);
                cout << endl;
                return;
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}
void solve(){
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
    {
        if(yes(i))
            cnt++;
        i++;
    }

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
    }
    else if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                for(int k = 0 ; k < 7 ; k++)
                    s[i + k] = comp[k];
                cout << "YES\n";
                for(int i = 0 ; i < n ; i++)
                        cout << ((s[i] == '?') ? 'z' : s[i]);
                cout << endl;
                return;
            }
        }
        cout << "NO\n";
    }
    else
        cout <<"NO\n";
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define forn(i , n) for(int i = 0 ; i < (int)n ; i++)

int n;
string s;

string comp = "abacaba";

bool yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

bool again_yes(int i)
{
    if(i + 6 >= n or i < 0)
        return false;
    for(int k = 0 ; k < 7 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    return true;
}

bool special_yes(int i)
{
    if(i + 6 >= n)
        return false;
    for(int k = 0 ; k < 3 ; k++)
        if(s[k + i] != comp[k] and s[k + i] != '?')
            return false;

    for(int k = 3 ; k < 7 ; k++)
        if(s[k + i] != comp[k])
            return false;

    return true;
}

void solve(){
    string temp = s;

    cin >> n >> s;

    int cnt = 0;
    for(int i = 0 ; i + 6 < n ; i++)
        cnt += yes(i);

    if(cnt == 1)
    {
        cout << "YES\n";
        for(int i = 0 ; i < n ; i++)
                cout << ((s[i] == '?') ? 'z' : s[i]);
        cout << endl;
        return;
    }

    if(cnt == 0)
    {
        for(int i = 0 ; i + 6 < n ; i++)
        {
            if(again_yes(i))
            {
                    for(int k = 0 ; k < 7 ; k++)
                        s[i + k] = comp[k];
                    if(yes(i - 4) or yes(i + 4))
                    {
                        for(int k = i ; k < i + 7 ; k++)
                            s[k] = temp[k];
                    }
                    else
                    {
                        cout << "YES\n";
                        for(int j = 0 ; j < n ; j++)
                                cout << ((s[j] == '?') ? 'z' : s[j]);
                        cout << endl;
                        return;
                    }
            }
        }
        cout << "NO\n";
        return;
    }
    cout <<"NO\n";
    return;
}

int32_t main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    cin >> t;
    while(t--)
        solve();
}


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0,cnt2 = 0;
        int A[55], B[55];
        int pos = 55;
        for(int i = 0; i <= n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7 && j < n; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
                }
                if(flag1) A[cnt1] = i, cnt1++;
                if(flag2) B[cnt2] = i, cnt2++;
            }
            if(a[i] == 'c') pos = i;
        }
    //cout << cnt1 << " " <<cnt2 << endl;
        if(cnt1 == 1) {
            printf("Yes\n");
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else if(cnt1 == 0 && cnt2 >= 1) {
            printf("Yes\n");
            //cout<<" "<< pos <<endl;
            int anspos = B[0];
            int minn = pos - B[0];
            for(int i = 0; i < cnt2; i++) {
                if(pos - B[i] <= 0) break;
                if(pos - B[i] < minn) {
                   minn = abs(pos - B[i]);
                   anspos = B[i];
                }
            }
            //cout <<" " << anspos << endl;
            for(int i = anspos; i < anspos + 7; i++)
                a[i] = ans[i - anspos];
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else printf("No\n");
    }

}
/*
100
13
???????bacaba
13
abacab???????
20
???????bacaba???????
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f3f;
int N, M;
int ans;
int main() {
    int T;
    scanf("%d", &T);
    while(T--) {
        int x[3];
        scanf("%d%d%d", &x[0], &x[1], &x[2]);
        sort(x, x + 3);
        //cout <<x[0] << " " <<x[1] <<" " << x[2] << endl;
        if(x[1] == x[2]) {
            printf("YES\n");
            printf("%d %d ", x[0], x[1]);
            printf("%d\n", max(1, x[0] - 1));
        }
        else printf("NO\n");
    }
}


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0,cnt2 = 0;
        int A[55], B[55];
        for(int i = 0; i <= n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7 && j < n; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
                }
                if(flag1) A[cnt1] = i, cnt1++;
                if(flag2) B[cnt2] = i, cnt2++;
            }
        }
    //cout << cnt1 << " " <<cnt2 << endl;
        if(cnt1 == 1) {
            printf("Yes\n");
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else if(cnt1 == 0 && cnt2 >= 1) {
            int pos = B[0];
            for(int i = pos; i < pos + 7; i++)
                a[i] = ans[i - pos];
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else printf("No\n");
    }

}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0,cnt2 = 0;
        int A[55], B[55];
        for(int i = 0; i <= n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7 && j < n; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
                }
                if(flag1) A[cnt1] = i, cnt1++;
                if(flag2) B[cnt2] = i, cnt2++;
            }
        }
    //cout << cnt1 << " " <<cnt2 << endl;
        if(cnt1 == 1) {
            printf("Yes\n");
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else if(cnt1 == 0 && cnt2 >= 1) {
            printf("Yes\n");
            int pos = B[0];
            for(int i = pos; i < pos + 7; i++)
                a[i] = ans[i - pos];
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else printf("No\n");
    }

}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i <= n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
    //cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                int flag = 1;
                for(int i = 0; i < n; i++) {
                    if(a[i] == 'a' || a[i] == '?') {
                        for(int j = i; j < i + 7; j++) {
                            if(a[j] !=  ans[i - j] && a[j] != '?') flag = 0;
                        }
                        if(flag) {
                            pos = i;
                            break;
                        }
                    }
                }
                for(int i = pos; i < pos + 7; i++) {
                    if(a[i] == '?') a[i] = ans[i - pos];
                }
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
    cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];

                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }
                 //cout << pos << " "<<cnt <<endl;

                    for(int i = 0; i < n; i++) cout <<b[i];
                    cout << endl;
                    pos += (cnt * 3);
           // cout <<pos << endl;
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0,cnt2 = 0;
        int A[55], B[55];
        for(int i = 0; i < n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7 && j < n; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
                }
                if(flag1) A[cnt1] = i, cnt1++;
                if(flag2) B[cnt2] = i, cnt2++;
            }
        }
    cout << cnt1 << " " <<cnt2 << endl;
        if(cnt1 == 1) {
            printf("Yes\n");
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        if(cnt1 == 0 && cnt2 >= 1) {
            int pos = B[0];
            for(int i = pos; i < pos + 7; i++)
                a[i] = ans[i - pos];
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else printf("No\n");
    }

}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {

}


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i <= n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
        //cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || cnt2 >= 1 && cnt1 != cnt2) {
            printf("Yes\n");
            if(cnt1 == 1 && cnt2 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt2 >= 1) {
                int pos = 0;
                int flag = 1;
                for(int i = 0; i < n; i++) {
                    if(a[i] == 'a' || a[i] == '?') {
                        for(int j = i; j < i + 7; j++) {
                            if(a[j] !=  ans[i - j] && a[j] != '?') flag = 0;
                        }
                        if(flag) {
                            pos = i;
                            break;
                        }
                    }
                }
                for(int i = pos; i < pos + 7; i++) {
                    if(a[i] == '?') a[i] = ans[i - pos];
                }
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            printf("\n");
        }
        else printf("No\n");
    }
}


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];

                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }
                 //cout << pos << " "<<cnt <<endl;

                    //for(int i = 0; i < n; i++) cout <<b[i];
                    //cout << endl;
                    pos += (cnt * 3);
           // cout <<pos << endl;
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];

                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }
                 //cout << pos << " "<<cnt <<endl;

                    //for(int i = 0; i < n; i++) cout <<b[i];
                    //cout << endl;
                    pos += ((cnt - 1) * 3);
           // cout <<pos << endl;
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
const char ans[] = "abacaba";
int n;
char a[MAX];
bool check(const char ss[]) {
    int cnt = 0;
    for(int i = 0; i <= n - 7; i++) {
        int flag1 = 1;
        if(ss[i] == 'a') {
            for(int j = i; j < i + 7 && j < n; j++) {
                if(ss[j] !=  ans[j - i]) flag1 = 0;
            }
            if(flag1) cnt++;
        }
    }
    return cnt == 1;
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
    int T;
    scanf("%d", &T);
    while(T--) {
        scanf("%d\n", &n);
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        bool flag = 0;
        for(int i = 0; i <= n - 7; i++) {
            char ss[MAX];
            for(int i = 0; i < n; i++) ss[i] = a[i];
            //for(int i = 0; i < n; i++) cout << ss[i];cout << endl;
            bool ok = 1;
            for(int j = i; j < i + 7 && j < n; j++) {
                if(ss[j] !=  ans[j - i] && ss[j] != '?') {
                    ok = 0;
                    break;
                }
                ss[j] = ans[j - i];
            }
            if(ok && check(ss)) {
            //for(int i = 0; i <n; i++) cout << ss[i];
            //cout << endl;
                for(int j = 0; j < n; j++) {
                    if(ss[j] == '?') ss[j] = 'd';
                }
                printf("YES\n");
                for(int k = 0; k < n; k++) {
                    printf("%c", ss[k]);
                }
                printf("\n");
                flag = 1;
                break;
            }
        }
        if(!flag) printf("NO\n");
    }
}
/*
100
13
abacab?bacaba
13
???????bacaba
13
abacab???????
20
???????bacaba???????
21
???????abacaba???????
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
47
a??ca?a?a???aba?a?acaba????c???cab????a??ba??ba
24
aba?aba?aba?aba?aba?aba?
22
aba?aba?aba?aba?aba?ab
22
abacaba?aba?aba?aba?ab
abacabadadddabadadacabaddddcdddcabddddaddbaddba

Yes
addcadadadddabadadacabaddddcabacabadddaddbaddba
abacabadadddabadadacabaddddcdddcabddddaddbaddba
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];
                while(1) {
                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }
                 //cout << pos << " "<<cnt <<endl;

                    //for(int i = 0; i < n; i++) cout <<b[i];
                    //cout << endl;
                    if(cnt == 1) break;
                    pos += ((cnt - 1) * 3);
           // cout <<pos << endl;
                }
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];

                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }
                 //cout << pos << " "<<cnt <<endl;

                    for(int i = 0; i < n; i++) cout <<b[i];
                    cout << endl;
                    pos += (cnt * 3);
           // cout <<pos << endl;
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 == 1) {
                int pos = 0;
                char b[MAX];

                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }

                  for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                     for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 > 1) {
                int pos = 0;
                char b[MAX];

                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }
                 //cout << pos << " "<<cnt <<endl;

                    //for(int i = 0; i < n; i++) cout <<b[i];
                    //cout << endl;
                    pos += (cnt * 3);
           // cout <<pos << endl;
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0,cnt2 = 0;
        int A[55], B[55];
        int pos = 55;
        for(int i = 0; i <= n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7 && j < n; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
                }
                if(flag1) A[cnt1] = i, cnt1++;
                if(flag2) B[cnt2] = i, cnt2++;
            }
            if(a[i] == 'c') pos = i;
        }
    //cout << cnt1 << " " <<cnt2 << endl;
        if(cnt1 == 1) {
            printf("Yes\n");
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else if(cnt1 == 0 && cnt2 >= 1) {
            //cout<<" "<< pos <<endl;
            int anspos = B[0];
            int minn = pos - B[0];
            for(int i = 0; i < cnt2; i++) {
                if(pos - B[i] <= 0) break;
                if(pos - B[i] < minn) {
                   minn = abs(pos - B[i]);
                   anspos = B[i];
                }
            }
            //cout <<" " << anspos << endl;
            for(int i = anspos; i < anspos + 7; i++)
                a[i] = ans[i - anspos];
            int cnt = 0;
            for(int i = 0; i <= n - 7; i++) {
                if(a[i] == 'a' || a[i] == '?') {
                    int flag1 = 1;
                    for(int j = i; j < i + 7 && j < n; j++) {
                        if(a[j] !=  ans[j - i]) flag1 = 0;
                    }
                    if(flag1) cnt++;
                }
                if(a[i] == 'c') pos = i;
            }
            if(cnt > 1) {
                printf("No\n");
                continue;
            }
            printf("Yes\n");
            for(int i = 0; i < n; i++) {
                if(a[i] == '?') printf("d");
                else printf("%c", a[i]);
            }
            printf("\n");
        }
        else printf("No\n");
    }

}
/*
100
13
abacab?bacaba
13
???????bacaba
13
abacab???????
20
???????bacaba???????
21
???????abacaba???????
43
?b?cab???bacaba?ab???b?cabac??ac??ac?b????a
47
a??ca?a?a???aba?a?acaba????c???cab????a??ba??ba
24
aba?aba?aba?aba?aba?aba?
22
aba?aba?aba?aba?aba?ab
22
abacaba?aba?aba?aba?ab
abacabadadddabadadacabaddddcdddcabddddaddbaddba

Yes
addcadadadddabadadacabaddddcabacabadddaddbaddba
abacabadadddabadadacabaddddcdddcabddddaddbaddba
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;
        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];
                while(1) {
                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                    }
                 //cout << pos << " "<<cnt <<endl;

                    //for(int i = 0; i < n; i++) cout <<b[i];
                    //cout << endl;
                    if(cnt == 1) break;
                    pos++;
           // cout <<pos << endl;
                }
//cout << pos << endl;
//for(int i = pos;i < n;i++) cout << b[i]; cout <<endl;
                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
*/


#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
const int INF = 0x3f3f3f3f3f3f3f;
int main() {
    char ans[] = "abacaba";
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d\n", &n);
        char a[55];
        for(int i = 0; i < n; i++) scanf("%c", &a[i]);
        int cnt1 = 0; int cnt2 = 0;
        for(int i = 0; i < n - 7; i++) {
            if(a[i] == 'a' || a[i] == '?') {
                int flag1 = 1, flag2 = 1;
                for(int j = i; j < i + 7; j++) {
                    if(a[j] !=  ans[j - i]) flag1 = 0;
                    if(a[j] !=  ans[j - i] && a[j] != '?') flag2 = 0;
   // cout << " " << a[j] << endl;
                }
                if(flag1) cnt1++;
                if(flag2) cnt2++;
            }
        }
   // cout << " " <<cnt1 <<" " << cnt2 << endl;

        if(cnt1 == 1 || (cnt2 >= 1 && cnt1 != cnt2)) {
            printf("Yes\n");
            if(cnt1 == 1) {
                for(int i = 0; i < n; i++) {
                    if(a[i] == '?') printf("d");
                    else printf("%c", a[i]);
                }
            }
            else if(cnt1 == 0 && cnt2 >= 1) {
                int pos = 0;
                char b[MAX];
                    int cnt = 0;
                    int flag = 1;
                    for(int i = 0; i < n; i++) {
                        b[i] = a[i];
                    }
                    for(int i = pos; i < n - 7; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag = 0;
                            }
                            if(flag) {
                                pos = i;
                                flag = 1;
                            }
                        }
                    }
                    for(int i = pos; i < n - 7; i++) {
                        if(b[i] == 'a' || b[i] == '?') {
                            int flag1 = 1, flag2 = 1;
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i]) flag1 = 0;
                                if(b[j] !=  ans[j - i] && b[j] != '?') flag2 = 0;
               // cout << " " << a[j] << endl;
                            }
                            if(flag2) cnt++;
                        }
                        if(cnt > 1)break;
                    }

                    pos += ((cnt - 1) * 3);

                    for(int i = pos; i <= n - 7; i++) {
                        int ff = 1;
                        if(b[i] == 'a' || b[i] == '?') {
                            for(int j = i; j < i + 7; j++) {
                                if(b[j] !=  ans[j - i] && b[j] != '?') {
                                    ff = 0;
                                }
                            }
                            if(ff) {
                        //cout << " " << i << endl;
                                for(int j = i; j < i + 7; j++) {
                                    if(b[j] == '?') b[j] = ans[j - i];
                                }
                                break;
                            }
                        }
                    }

                for(int i = 0; i < n; i++) {
                    if(b[i] == '?') printf("d");
                    else printf("%c", b[i]);
                }
            }
            //else if(cnt2 >= 1 && )
            printf("\n");
        }
        else printf("No\n");
    }
}
/*
100
13
???????bacaba
*/