#include<bits/stdc++.h>
#define re return
#define ll long long
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;
int n,k,last,temp;
string hh[66],out[66];
string s[100];
int main(){
    for(int i=0;i<26;++i)
        hh[i]=i+'A';
    for(int i=26;i<52;++i)
        hh[i]=i+'A';
    for(int i=26;i<52;i++)
        hh[i]+='a';
    cin >> n >> k;
    for(int i=0;i<=n-k;++i)
        cin >> s[i];
    if(s[0]=="YES"){
        for(int i=0;i<k;++i)
            out[i]=hh[i],last++;
    }
    for(int i=1;i<=n-k;++i){
        if(s[i]=="YES"){
            if(s[i-1]=="YES"){
                out[i+k-1]=hh[last];
                last++;
            }
            else{
                for(int j=i;j<i+k;++j){
                    out[j]=hh[last];
                    last++;
                }
            }
        }
    }
    for(int i=0;i<n;++i)
        if(!out[i].size())
            out[i]="*";
    int t=50;
    while(t--){
        for(int i=0;i<n;i++){
            if(out[i]=="*"&&out[i+1].size()&&out[i+1]!="*"){
                temp=k-1;
                for(int j=i;temp>=0&&j>=0;j--){
                    out[j]=out[i+1];
                }
            }
            else if(out[i+1]=="*"&&out[i].size()&&out[i]!="*"){
                temp=k-1;
                for(int j=i+1;temp>=0&&j<n;j++){
                    out[j]=out[i];
                }
            }
        }
    }
    int c=0;
    for(int i=0;i<n;++i)
        if(out[i]=="*")c++;
    if(c==n)
        for(int i=0;i<n;++i)out[i]='S';
    for(int i=0;i<n;++i)
        cout<<out[i]<<((i==n-1)?"\n":" ");
	re 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,k;
string s[53],str,strA,strB;
string name[53];
bool vis[53];
bool is[53];

int main()
{
	strA = "A";
	strB = "B";
	for(int i = 0; i < 26; i++)
		s[i] = strA + (char)('a'+i);
	for(int i = 26; i < 52; i++)
		s[i] = strB + (char)('a'+i-26);
	cin >> n >> k;
	for(int i = 1; i <= n - k + 1; i++)
	{
		cin >> str;
		if(str == "YES")
			vis[i] = true;
		else
			vis[i] = false;
	}
	name[0] = s[0];
	name[n] = s[n];
	for(int i = 1; i <= n - k + 1; i++)
	{
		if(vis[i] == true)
		{
			int kk = i;
			while(kk > 1 && !is[kk-1])
			{
				is[kk-1] = true;
				name[kk-1] = s[i];
				kk--;
			}
			for(int j = i; j <= i + k - 1; j++)
			{
				name[j] = s[j];
				is[j] = true;
			}
		}
	}
	if(k == 2)
	{
		for(int i = n-1; i >= 1; i--)
			if(!vis[i])
				name[i] = name[i+1];
	}
	else
		for(int i = 1; i <= n; i++)
			if(!is[i])
				name[i] = name[i-1];
	for(int i = 1; i < n; i++)
		cout << name[i] << " ";
	cout << name[n] << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,k;
string s[53],str,strA,strB;
string name[53];
bool vis[53];
bool is[53];

int main()
{
	strA = "A";
	strB = "B";
	for(int i = 0; i < 26; i++)
		s[i] = strA + (char)('a'+i);
	for(int i = 26; i < 52; i++)
		s[i] = strB + (char)('a'+i-26);
	cin >> n >> k;
	for(int i = 1; i <= n - k + 1; i++)
	{
		cin >> str;
		if(str == "YES")
			vis[i] = true;
		else
			vis[i] = false;
	}
	name[0] = s[0];
	for(int i = 1; i <= n - k + 1; i++)
	{
		if(vis[i] == true)
		{
			int kk = i;
			while(kk > 1 && !is[kk-1])
			{
				is[kk-1] = true;
				name[kk-1] = s[i];
				kk--;
			}
			for(int j = i; j <= i + k - 1; j++)
			{
				name[j] = s[j];
				is[j] = true;
			}
		}
	}
	for(int i = 1; i <= n; i++)
		if(!is[i])
			name[i] = name[i-1];
	for(int i = 1; i < n; i++)
		cout << name[i] << " ";
	cout << name[n] << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,k;
string s[53],str,strA,strB;
string name[53];
bool vis[53];
bool is[53];

int main()
{
	strA = "A";
	strB = "B";
	for(int i = 0; i < 26; i++)
		s[i] = strA + (char)('a'+i);
	for(int i = 26; i < 52; i++)
		s[i] = strB + (char)('a'+i-26);
	cin >> n >> k;
	for(int i = 1; i <= n - k + 1; i++)
	{
		cin >> str;
		if(str == "YES")
			vis[i] = true;
		else
			vis[i] = false;
	}
	name[0] = s[0];
	name[n] = s[n];
	for(int i = 1; i <= n - k + 1; i++)
	{
		if(vis[i] == true)
		{
			int kk = i;
			while(kk > 1 && !is[kk-1])
			{
				is[kk-1] = true;
				name[kk-1] = s[i];
				kk--;
			}
			for(int j = i; j <= i + k - 1; j++)
			{
				name[j] = s[j];
				is[j] = true;
			}
		}
	}
	if(k == 2)
	{
		for(int i = 1; i < n; i++)
			if(!vis[i])
				name[i] = name[i+1];
	}
	else
		for(int i = 1; i <= n; i++)
			if(!is[i])
				name[i] = name[i-1];
	for(int i = 1; i < n; i++)
		cout << name[i] << " ";
	cout << name[n] << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,k;
string s[53],str,strA,strB;
string name[53];

int main()
{
	strA = "A";
	strB = "B";
	for(int i = 0; i < 26; i++)
		s[i] = strA + (char)('a'+i);
	for(int i = 26; i < 52; i++)
		s[i] = strB + (char)('a'+i-26);
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
		name[i] = s[i];
	for(int i = 1; i <= n - k + 1; i++)
	{
		cin >> str;
		if(str == "NO")
			name[i+k-1] = s[i];
	}
	for(int i = 1; i < n; i++)
		cout << name[i] << " ";
	cout << name[n] << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,k;
string s[53],str,strA,strB;
string name[53];

int main()
{
	strA = "A";
	strB = "B";
	for(int i = 0; i < 26; i++)
		s[i] = strA + (char)('a'+i);
	for(int i = 26; i < 52; i++)
		s[i] = strB + (char)('a'+i-26);
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
		name[i] = s[i];
	for(int i = 1; i <= n - k + 1; i++)
	{
		cin >> str;
		if(str == "NO")
			name[i+k-1] = name[i];
	}
	for(int i = 1; i < n; i++)
		cout << name[i] << " ";
	cout << name[n] << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,k;
string s[53],str,strA,strB;
string name[53];
bool vis[53];
bool is[53];

int main()
{
	strA = "A";
	strB = "B";
	for(int i = 0; i < 26; i++)
		s[i] = strA + (char)('a'+i);
	for(int i = 26; i < 52; i++)
		s[i] = strB + (char)('a'+i);
	cin >> n >> k;
	for(int i = 1; i <= n - k + 1; i++)
	{
		cin >> str;
		if(str == "YES")
			vis[i] = true;
		else
			vis[i] = false;
	}
	name[0] = s[0];
	for(int i = 1; i <= n - k + 1; i++)
	{
		if(vis[i] == true)
		{
			int kk = i;
			while(kk > 1 && !is[kk-1])
			{
				is[kk-1] = true;
				name[kk-1] = s[i];
				kk--;
			}
			for(int j = i; j <= i + k - 1; j++)
			{
				name[j] = s[j];
				is[j] = true;
			}
		}
	}
	for(int i = 1; i <= n; i++)
		if(!is[i])
			name[i] = name[i-1];
	for(int i = 1; i < n; i++)
		cout << name[i] << " ";
	cout << name[n] << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=1;i<=K;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		names.push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	int npos=0;
	int prev=choice[0];
	int j;
	int ppos=0;
	for(int i=1;i<n-K+1;i++)
	{
		j=i;
		while(choice[j]==prev&&j<n-K+1)
		{
			j++;
		}
		//cout<<i<<" "<<j<<" "<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<=max(ppos,j);k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=max(ppos+1,j+1);
		}
		else
		{
			for(int k=ppos;k<max(j+K-1,ppos+1);k++)
			{
				//cout<<npos<<endl;
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			ppos=max(ppos+1,j+K-1);
			npos=(npos-1+K)%K;
		}
		i=j;
		if(j!=n-K+1)
			prev=choice[j];
		//cout<<"NOW we have"<<prev<<endl;
	}
	//cout<<j<<" "<<n-K<<endl;
	if(j==n-K)
	{
		//cout<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<n;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
		}
		else
		{
			for(int k=ppos;k<n;k++)
			{
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			npos=(npos-1+K)%K;
		}
	}
	//cout<<"DONE"<<endl;
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=0;i<n;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		ans[i].push_back(ch);
		sp++;
		if(i==25)
		{
			cp++;
			sp='a';
		}
	}
	for(int i=0;i<n-K+1;i++)
	{
		if(!choice[i])
			ans[i+K-1][0]=ans[i][0];
	}
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=0;i<n;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		ans[i].push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	for(int i=0;i<n-K+1;i++)
	{
		if(!choice[i])
			ans[i+K-1][0]=ans[i][0];
	}
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=1;i<=K;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		names.push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	int npos=0;
	int prev=choice[0];
	int j;
	int ppos=0;
	for(int i=1;i<n-K+1;i++)
	{
		j=i;
		while(choice[j]==prev&&j<n-K+1)
		{
			j++;
		}
		//cout<<i<<" "<<j<<" "<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<=j;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=j+1;
		}
		else
		{
			for(int k=ppos;k<j+K-1;k++)
			{
				//cout<<npos<<endl;
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			ppos=j+K-1;
			npos=(npos-1+K)%K;
		}
		i=j;
		if(j!=n-K+1)
			prev=choice[j];
		//cout<<"NOW we have"<<prev<<endl;
	}
	//cout<<j<<" "<<n-K<<endl;
	if(j==n-K)
	{
		//cout<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<n;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
		}
		else
		{
			for(int k=ppos;k<n;k++)
			{
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			npos=(npos-1+K)%K;
		}
	}
	//cout<<"DONE"<<endl;
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=1;i<=K;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		names.push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	int npos=0;
	int prev=choice[0];
	int j;
	int ppos=0;
	for(int i=1;i<n-K+1;i++)
	{
		j=i;
		while(choice[j]==prev&&j<n-K+1)
		{
			j++;
		}
		//cout<<i<<" "<<j<<" "<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<=max(ppos,j);k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=max(ppos+1,j+1);
		}
		else
		{
			for(int k=ppos;k<max(j+K-1,ppos+1);k++)
			{
				//cout<<npos<<endl;
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			ppos=max(ppos+1,j+K-1);
			npos=(npos-1+K)%K;
		}
		i=j;
		if(j!=n-K+1)
			prev=choice[j];
		//cout<<"NOW we have"<<prev<<endl;
	}
	//cout<<j<<" "<<n-K<<endl;
	if(j==n-K)
	{
		//cout<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<n;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=n;
		}
		else
		{
			for(int k=ppos;k<n;k++)
			{
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			npos=(npos-1+K)%K;
			ppos=n;
		}
	}
	for(int i=ppos;i<n;i++)
	{
		ans[i].push_back(names[npos]);
		npos=(npos+1)%K;
	}
	//cout<<"DONE"<<endl;
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=1;i<=K;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		names.push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	int npos=0;
	int prev=choice[0];
	int j;
	int ppos=0;
	for(int i=1;i<n-K+1;i++)
	{
		j=i;
		while(choice[j]==prev&&j<n-K+1)
		{
			j++;
		}
		//cout<<i<<" "<<j<<" "<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<=max(ppos,j);k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=max(ppos+1,j+1);
		}
		else
		{
			for(int k=ppos;k<max(j+K-1,ppos+1);k++)
			{
				//cout<<npos<<endl;
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			ppos=max(ppos+1,j+K-1);
			npos=(npos-1+K)%K;
		}
		i=j;
		if(j!=n-K+1)
			prev=choice[j];
		//cout<<"NOW we have"<<prev<<endl;
	}
	//cout<<j<<" "<<n-K<<endl;
	if(j==n-K)
	{
		//cout<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<n;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=n;
		}
		else
		{
			for(int k=ppos;k<n;k++)
			{
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			npos=(npos-1+K)%K;
			ppos=n;
		}
	}
	if(!prev)
		npos=(npos-1+K)%K;
	for(int i=ppos;i<n;i++)
	{
		ans[i].push_back(names[npos]);
		if(prev)
		npos=(npos+1)%K;
	}
	//cout<<"DONE"<<endl;
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=1;i<=K;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		names.push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	int npos=0;
	int prev=choice[0];
	int j;
	int ppos=0;
	for(int i=1;i<n-K+1;i++)
	{
		j=i;
		while(choice[j]==prev&&j<n-K+1)
		{
			j++;
		}
		//cout<<i<<" "<<j<<" "<<prev<<endl;
		if(!prev)
		{
			j=max(j,ppos);
			for(int k=ppos;k<=j;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=j+1;
		}
		else
		{
			for(int k=ppos;k<max(j+K-1,ppos+1);k++)
			{
				//cout<<npos<<endl;
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			ppos=max(ppos+1,j+K-1);
			npos=(npos-1+K)%K;
		}
		i=j;
		if(j!=n-K+1)
			prev=choice[j];
		//cout<<"NOW we have"<<prev<<endl;
	}
	//cout<<j<<" "<<n-K<<endl;
	if(j==n-K)
	{
		//cout<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<n;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
		}
		else
		{
			for(int k=ppos;k<n;k++)
			{
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			npos=(npos-1+K)%K;
		}
	}
	//cout<<"DONE"<<endl;
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>choice;
string s;
vector<string>names;
vector<string>ans[100];
int main() {
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n-K+1;i++)
	{
		cin>>s;
		if(s=="YES")
			choice.push_back(1);
		else
			choice.push_back(0);
	}
	char cp,sp;
	cp='A';
	sp='a';
	for(int i=1;i<=K;i++)
	{
		string ch;
		ch.push_back(cp);
		ch.push_back(sp);
		names.push_back(ch);
		sp++;
		if(i==26)
		{
			cp++;
			sp='a';
		}
	}
	int npos=0;
	int prev=choice[0];
	int j;
	int ppos=0;
	for(int i=1;i<n-K+1;i++)
	{
		j=i;
		while(choice[j]==prev&&j<n-K+1)
		{
			j++;
		}
		//cout<<i<<" "<<j<<" "<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<=max(ppos,j);k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
			ppos=max(ppos+1,j+1);
		}
		else
		{
			for(int k=ppos;k<max(j+K-1,ppos+1);k++)
			{
				//cout<<npos<<endl;
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			ppos=max(ppos+1,j+K-1);
			npos=(npos-1+K)%K;
		}
		i=j;
		if(j!=n-K+1)
			prev=choice[j];
		//cout<<"NOW we have"<<prev<<endl;
	}
	//cout<<j<<" "<<n-K<<endl;
	if(j==n-K)
	{
		//cout<<prev<<endl;
		if(!prev)
		{
			for(int k=ppos;k<n;k++)
				ans[k].push_back(names[npos]);
			npos=(npos+1)%K;
		}
		else
		{
			for(int k=ppos;k<n;k++)
			{
				ans[k].push_back(names[npos]);
				npos=(npos+1)%K;
			}
			npos=(npos-1+K)%K;
		}
	}
	for(int i=ppos;i<n;i++)
	{
		ans[i].push_back(names[npos]);
		npos=(npos+1)%K;
	}
	//cout<<"DONE"<<endl;
	for(int i=0;i<n;i++)
		cout<<ans[i][0]<<" ";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <map>
#define MAXN 110
#define INF 1 << 30

using namespace std;

string str[] = {"Aa", "Ab", "Ac", "Ad", "Ae"};

int main() {
    int n, m;
    while (cin >> n >> m) {
        vector<string> vec;
        string x;
        cin >> x;
        if (x == "YES") {
            for (int i = 0; i < m; ++i) {
                string y = str[i % 5];
                for (int j = 0; j < i / 5; ++j) {
                    y += 'a';
                }
                vec.push_back(y);
            }
        }
        else {
            for (int i = 0; i < m - 1; ++i) {
                string y = str[i % 5];
                for (int j = 0; j < i / 5; ++j) {
                    y += 'a';
                }
                vec.push_back(y);
            }
            vec.push_back(vec[0]);
        }
        for (int i = 1; i < n - m + 1; ++i) {
            cin >> x;
            if (x == "YES") {
                string y = vec[i];
                y += 'a';
                vec.push_back(y);
            }
            else {
                string y = vec[i];
                vec.push_back(y);
            }
        }
        for (int i = 0; i < n; ++i) {
            if (i == n - 1) {
                cout << vec[i] << endl;
            }
            else {
                cout << vec[i] << " ";
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <map>
#define MAXN 110
#define INF 1 << 30

using namespace std;

string str[] = {"Aa", "Ab", "Ac", "Ad", "Ae", "Ba", "Bb", "Bc", "Bd", "Be",
                "Ca", "Cb", "Cc", "Cd", "Ce", "Da", "Db", "Dc", "Dd", "De",
                "Ea", "Eb", "Ec", "Ed", "Ee", "Fa", "Fb", "Fc", "Fd", "Fe",
                "Ga", "Gb", "Gc", "Gd", "Ge", "Ha", "Hb", "Hc", "Hd", "He",
                "Ja", "Jb", "Jc", "Jd", "Je", "Ka", "Kb", "Kc", "Kd", "Ke"};

int main() {
    int n, m;
    while (cin >> n >> m) {
        vector<string> vec;
        string x;
        cin >> x;
        if (x == "YES") {
            for (int i = 0; i < m; ++i) {
                string y = str[i];
                vec.push_back(y);
            }
        }
        else {
            for (int i = 0; i < m - 1; ++i) {
                string y = str[i];
                vec.push_back(y);
            }
            vec.push_back(vec[0]);
        }
        for (int i = 1; i < n - m + 1; ++i) {
            cin >> x;
            if (x == "YES") {
                string y = str[i + m - 1];
                vec.push_back(y);
            }
            else {
                vec.push_back(vec[i]);
            }
        }
        for (int i = 0; i < n; ++i) {
            if (i == n - 1) {
                cout << vec[i] << endl;
            }
            else {
                cout << vec[i] << " ";
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <map>
#define MAXN 110
#define INF 1 << 30

using namespace std;

string str[] = {"Aa", "Ab", "Ac", "Ad", "Ae"};

int main() {
    int n, m;
    while (cin >> n >> m) {
        vector<string> vec;
        string x;
        cin >> x;
        if (x == "YES") {
            for (int i = 0; i < m; ++i) {
                string y = str[i % 5];
                for (int j = 0; j < i / 5; ++j) {
                    y += 'a';
                }
                vec.push_back(y);
            }
        }
        else {
            for (int i = 0; i < m - 1; ++i) {
                string y = str[i % 5];
                for (int j = 0; j < i / 5; ++j) {
                    y += 'c';
                }
                vec.push_back(y);
            }
            vec.push_back(vec[0]);
        }
        for (int i = 1; i < n - m + 1; ++i) {
            cin >> x;
            if (x == "YES") {
                string y = vec[i];
                y += 'd';
                vec.push_back(y);
            }
            else {
                string y = vec[i];
                vec.push_back(y);
            }
        }
        for (int i = 0; i < n; ++i) {
            if (i == n - 1) {
                cout << vec[i] << endl;
            }
            else {
                cout << vec[i] << " ";
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <map>
#define MAXN 110
#define INF 1 << 30

using namespace std;

string str[] = {"Aa", "Ab", "Ac", "Ad", "Ae", "Ba", "Bb", "Bc", "Bd", "Be",
                "Ca", "Cb", "Cc", "Cd", "Ce", "Da", "Db", "Dc", "Dd", "De",
                "Ea", "Eb", "Ec", "Ed", "Ee", "Fa", "Fb", "Fc", "Fd", "Fe",
                "Ga", "Gb", "Gc", "Gd", "Ge", "Ha", "Hb", "Hc", "Hd", "He",
                "Ja", "Jb", "Jc", "Jd", "Je", "Ka", "Kb", "Kc", "Kd", "Ke"};

int main() {
    int n, m;
    while (cin >> n >> m) {
        vector<string> vec;
        string x;
        cin >> x;
        if (x == "YES") {
            for (int i = 0; i < m; ++i) {
                string y = str[i];
                vec.push_back(y);
            }
        }
        else {
            for (int i = 0; i < m - 1; ++i) {
                string y = str[i];
                vec.push_back(y);
            }
            vec.push_back(vec[0]);
        }
        for (int i = 1; i < n - m + 1; ++i) {
            cin >> x;
            if (x == "YES") {
                string y = str[i + m];
                vec.push_back(y);
            }
            else {
                vec.push_back(vec[i]);
            }
        }
        for (int i = 0; i < n; ++i) {
            if (i == n - 1) {
                cout << vec[i] << endl;
            }
            else {
                cout << vec[i] << " ";
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <map>
#define MAXN 110
#define INF 1 << 30

using namespace std;

string str[] = {"Aa", "Ab", "Ac", "Ad", "Ae", "Ba", "Bb", "Bc", "Bd", "Be"};

int main() {
    int n, m;
    while (cin >> n >> m) {
        vector<string> vec;
        string x;
        cin >> x;
        if (x == "YES") {
            for (int i = 0; i < m; ++i) {
                string y = str[i % 10];
                for (int j = 0; j < i / 10; ++j) {
                    y += 'a';
                }
                vec.push_back(y);
            }
        }
        else {
            for (int i = 0; i < m - 1; ++i) {
                string y = str[i % 10];
                for (int j = 0; j < i / 10; ++j) {
                    y += 'c';
                }
                vec.push_back(y);
            }
            vec.push_back(vec[0]);
        }
        for (int i = 1; i < n - m + 1; ++i) {
            cin >> x;
            if (x == "YES") {
                string y = vec[i].substr(0, vec[i].size() - 1);
                y += ('d' + i);
                vec.push_back(y);
            }
            else {
                string y = vec[i];
                vec.push_back(y);
            }
        }
        for (int i = 0; i < n; ++i) {
            if (i == n - 1) {
                cout << vec[i] << endl;
            }
            else {
                cout << vec[i] << " ";
            }
        }
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <map>
#define MAXN 110
#define INF 1 << 30

using namespace std;

string str[] = {"Aa", "Ab", "Ac", "Ad", "Ae", "Ba", "Bb", "Bc", "Bd", "Be"};

int main() {
    int n, m;
    while (cin >> n >> m) {
        vector<string> vec;
        string x;
        cin >> x;
        if (x == "YES") {
            for (int i = 0; i < m; ++i) {
                string y = str[i % 10];
                for (int j = 0; j < i / 10; ++j) {
                    y += 'a';
                }
                vec.push_back(y);
            }
        }
        else {
            for (int i = 0; i < m - 1; ++i) {
                string y = str[i % 10];
                for (int j = 0; j < i / 10; ++j) {
                    y += 'c';
                }
                vec.push_back(y);
            }
            vec.push_back(vec[0]);
        }
        for (int i = 1; i < n - m + 1; ++i) {
            cin >> x;
            if (x == "YES") {
                string y = vec[i];
                y += 'd';
                vec.push_back(y);
            }
            else {
                string y = vec[i];
                vec.push_back(y);
            }
        }
        for (int i = 0; i < n; ++i) {
            if (i == n - 1) {
                cout << vec[i] << endl;
            }
            else {
                cout << vec[i] << " ";
            }
        }
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "Aaaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res(n);
    for (int i = 0; i < n; i++) {
        start[pos] = (char)(start[pos]+1);
        if (start[pos] == 'z') {
            pos--;
        }
        res[i] = start;
    }
    for (int i = 0; i < n; i++) {
        if (i < n - k + 1 && !v[i]) {
            res[i] = res[i + k - 1];
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "aaaaaaaaa";
    int pos = 8;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res(n,start);
    for (int i = 0; i < n - k + 1; i++) {
        if (v[i]) {
            for(int j = i ; j < k + i ; j ++){
                start[pos] = (char)(start[pos]+1);
                if (start[pos] == 'z') {
                    pos--;
                }
                res[j] = start;
            }
        }
    }
    for (int i = 0; i < res.size(); i++) {
        if (res[i] == "aaaaaaaaa") {
            res[i] = ((i == n - 1) ? res[i-1] : res[i+1]);
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "aaaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res(n,start);
    for (int i = 0; i < n - k + 1; i++) {
        if (v[i]) {
            for(int j = i ; j < k + i ; j ++){
                start[pos] = (char)(start[pos]+1);
                if (start[pos] == 'z') {
                    pos--;
                }
                res[j] = start;
            }
        }
    }
    for (int i = 0; i < res.size(); i++) {
        if (res[i] == "aaaaaaaaaa") {
            res[i] = ((i == n - 1) ? res[i-1] : res[i+1]);
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "Aaaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res;
    if(v[0]){
        res.pb(start);
        for(int i = 1 ; i < k ;i ++){
            start[pos] = (char)(start[pos]+1);
            if (start[pos] == 'z') {
                pos--;
            }
            res.pb(start);
        }

    }else{
        for (int i = 0; i < k; i++) {
            res.pb(start);
        }
    }
    for (int i = 1; i < n - k + 1; i++) {
        if (v[i]) {
            start[pos] = (char)(start[pos]+1);
            if (start[pos] == 'z') {
                pos--;
            }
        }
        res.pb(start);
    }
    for (int i = 0; i < res.size(); i++) {

        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "Aaaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res(n);
    for (int i = 0; i < n; i++) {
        start[pos] = (char)(start[pos]+1);
        if (start[pos] == 'z') {
            pos--;
        }
        res[i] = start;
    }
    for (int i = 0; i < n; i++) {
        if (i < n - k + 1 && !v[i]) {
            res[i + k - 1] = res[i];
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "aaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res(n,start);
    for (int i = 0; i < n - k + 1; i++) {
        if (v[i]) {
            for(int j = i ; j < k + i ; j ++){
                start[pos] = (char)(start[pos]+1);
                if (start[pos] == 'z') {
                    pos--;
                }
                res[j] = start;
            }
        }
    }
    for (int i = 0; i < res.size(); i++) {
        if (res[i] == "aaaaaaaaa") {
            res[i] = ((i == n - 1) ? res[i-1] : res[i+1]);
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "aaaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res;
    if (v[0]) {
        for (int i = 0; i < k; i++) {
            res.pb(start);
            start[pos] = (char)(start[pos]+1);
            if (start[pos] == 'z') {
                pos--;
            }
        }
    }else{
        for (int i = 0; i < k; i++) {
            res.pb(start);
        }
    }
    for (int i = 1; i < n - k + 1; i++) {
        if (v[i]) {
            start[pos] = (char)(start[pos]+1);
            if (start[pos] == 'z') {
                pos--;
            }
            res.pb(start);
        }else res.pb(start);
    }
    for (int i = 0; i < res.size(); i++) {
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <map>
#include <unordered_map>
#include <set>
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>
#define PI acos(-1.0)
#define INF 2000000000
#define llINF 1e16
#define EPS 1e-9
#define sz(v)        static_cast<int>((v).size())
#define pb(...)      push_back(__VA_ARGS__)
#define mp(x, y)     make_pair((x), (y))
#define clr(x) memset(x, 0, sizeof(x))
#define clr1(x) memset(x, INF, sizeof(x))
#define dREP(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define NOT(x)  (1^(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> Graph;
typedef map<int, int>::iterator it_type;
typedef vector<int> row;
typedef vector<row> matrix;
int MOD  = 1000000007;
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline ll toll(string s){ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
#define rep(i, v) for(int i=0;i<sz(v);++i)
#define MAX 103
#define LSOne(S) (S & (-S))

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    //freopen("grant.in" , "r", stdin);
    //freopen("grant.out" , "w", stdout);
    int n,k;
    cin>>n>>k;
    string start = "Aaaaaaaaaa";
    int pos = 9;
    vector<bool> v(n - k + 1);
    for (int i = 0;i < n - k + 1; i++) {
        string s;
        cin>>s;
        if (s == "YES") {
            v[i] = 1;
        }else{
            v[i] = 0;
        }
    }
    vector<string> res(n,start);
    for (int i = 0; i < n - k + 1; i++) {
        if (v[i]) {
            for(int j = i ; j < i + k ; j ++){
                start[pos] = (char)(start[pos]+1);
                if (start[pos] == 'z') {
                    pos--;
                }
                res[i] = start;
            }
        }
    }
    for (int i = 0; i < res.size(); i++) {
        if (res[i] == "Aaaaaaaaaa") {
            res[i] = (i == n -1 ? res[i-1] : res[i+1]);
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
string get(int x)
{
    if(x<=25)
    {
        char a=x+'A';
        string w;
        w.push_back(a);
        return w;
    }
    else
    {
        x-=26;
        char a=x+'A';
        string w;
        w.push_back(a);
        a=x+'a';
        w.push_back(a);
        return w;
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    int m=n-k;
    m++;
    string s[m],d[50]={};
    for (int i=0;i<m;i++)
        cin>>s[i];
    int q=0,x=0;
    string f="";
    for (int i=0;i<m;i++)
    {
        if(s[i]=="YES")
        {
            x=max(x,i);
            for (;x<i+k;x++)
            {
                d[x]=get(q);
                f=d[x];
                q++;
            }
        }
    }
    if(q>0)
    q--;
    if(f=="")
        f=get(q);
    for (int i=n-1;i>=0;i--)
    {
        if(d[i]=="")
        {
            d[i]=f;
        }
        else
            f=d[i];
    }
    for (int i=0;i<n;i++)
        cout<<d[i]<<" ";
    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<stack>
#include<string>
#include<unordered_set>
#include<unordered_map>
#include<cmath>
#include<deque>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define ll long long
const long long NUM=1e9+7;
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    res=res%NUM;
    if (b % 2)
        return (((res * res)%NUM)* a)%NUM;
    else
        return (res * res)%NUM;
}
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};//unordered_map<pair<long long, long long>, bool, hash_pair> um;
long long fact(long long n);

long long nCr(long long n, long long r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
long long fact(long long n)
{
    long long res = 1;
    for (long long i = 2; i <= n; i++)
        res = (res * i)%NUM;
    return (res)%NUM;
}
long long dif(long long a,long long b)
{
    if(a>b)
        return a-b;
    return b-a;
}
long long gcd(long long a,long long b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
long long lcm(long long a,long long b)
{
    long long k=gcd(a,b);
    return (a*b)/k;
}
bool mycmp(pair<int,int>p1,pair<int,int>p2)
{
    if(p1.first<p2.first)
    {
        return true;
    }
    if(p1.first==p2.first)
    {
        return p1.second<p2.second;
    }
    return false;
}
void ip(int &number)
{
    bool negative = false;
    register int c;
    number = 0;
    c = getchar();
    if (c=='-')
    {
        negative = true;
        c = getchar();
    }

    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;
    if (negative)
        number *= -1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;cin>>t;
    while(t--)
    {
        int n;cin>>n;
        string s;cin>>s;
        stack<pair<int,int>>s1,s0;//s1 needs 1 and s0 needs 0;
        int high=0;
        int arr[n];
        for(int i=0;i<n;i++)
        {
            if(s[i]=='0')
            {
                if(s0.empty())
                {
                    arr[i]=high+1;
                    s1.push({high+1,high+1});high++;
                }
                else
                {
                    arr[i]=s0.top().first;
                    s1.push({s0.top().first,s0.top().first});s0.pop();
                }
            }
            else
            {
                if(s1.empty())
                {
                    arr[i]=high+1;
                    s0.push({high+1,high+1});high++;
                }
                else
                {
                    arr[i]=s1.top().second;
                    s0.push({s1.top().first,s1.top().first});s1.pop();
                }
            }
        }
        cout<<high<<endl;
        for(int x:arr)
        cout<<x<<" ";
        cout<<endl;
    }
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
   int t;
   cin>>t;
   while(t--)
   {
       int n,i;
       cin>>n;
       string s;
       cin>>s;
       int c=0,c1=0,c0=0;
       int a[n];
       for(i=0;i<n;i++)
       {
           if(s[i]=='1')
           {
               if(c0>0)
               {
                   c1++;
                   a[i]=c-c0;
                   c0--;
               }
               else
               {
                   c1++;c++;
                   a[i]=c1;
               }
           }
           else
           {
               if(c1>0)
               {
                   c0++;
                   a[i]=c1;
                   c1--;

               }
               else
               {
                   c0++;c++;a[i]=c;
               }
           }
       }
       cout<<c<<endl;
       for(i=0;i<n;i++) cout<<a[i]<<" ";
       cout<<endl;
   }
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
   int t;
   cin>>t;
   while(t--)
   {
       int n,i;
       cin>>n;
       string s;
       cin>>s;
       int c=0,c1=0,c0=0;
       int a[n];
       for(i=0;i<n;i++)
       {
           if(s[i]=='1')
           {
               if(c0>0)
               {
                   c1++;
                   a[i]=c1;
                   c0--;
               }
               else
               {
                   c1++;c++;
                   a[i]=c;
               }
           }
           else
           {
               if(c1>0)
               {
                   a[i]=c1;
                   c0++;
                   c1--;
               }
               else
               {
                   c0++;c++;a[i]=c;
               }
           }
       }
       cout<<c<<endl;
       for(i=0;i<n;i++) cout<<a[i]<<" ";
       cout<<endl;
   }
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
   int t;
   cin>>t;
   while(t--)
   {
       int n,i;
       cin>>n;
       string s;
       cin>>s;
       int c=0,c1=0,c0=0;
       int a[n];
       for(i=0;i<n;i++)
       {
           if(s[i]=='1')
           {
               if(c0>0)
               {
                   c1++;
                   a[i]=c0;
                   c0--;
               }
               else
               {
                   c1++;c++;
                   a[i]=c;
               }
           }
           else
           {
               if(c1>0)
               {
                   c0++;
                   a[i]=c1;
                   c1--;

               }
               else
               {
                   c0++;c++;a[i]=c;
               }
           }
       }
       cout<<c<<endl;
       for(i=0;i<n;i++) cout<<a[i]<<" ";
       cout<<endl;
   }
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
   int t;
   cin>>t;
   while(t--)
   {
       int n,i;
       cin>>n;
       string s;
       cin>>s;
       int c=0,c1=0,c0=0;
       int a[n];
       for(i=0;i<n;i++)
       {
           if(s[i]=='1')
           {
               if(c0>0)
               {
                   c1++;
                   a[i]=c1;
                   c0--;
               }
               else
               {
                   c1++;c++;
                   a[i]=c;
               }
           }
           else
           {
               if(c1>0)
               {
                   a[i]=c-c0;
                   c0++;
                   c1--;
               }
               else
               {
                   c0++;c++;a[i]=c;
               }
           }
       }
       cout<<c<<endl;
       for(i=0;i<n;i++) cout<<a[i]<<" ";
       cout<<endl;
   }
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
   int t;
   cin>>t;
   while(t--)
   {
       int n,i;
       cin>>n;
       string s;
       cin>>s;
       int c=0,c1=0,c0=0;
       int a[n];
       for(i=0;i<n;i++)
       {
           if(s[i]=='1')
           {
               if(c0>0)
               {
                   c1++;
                   a[i]=c0;
                   c0--;
               }
               else
               {
                   c1++;c++;
                   a[i]=c;
               }
           }
           else
           {
               if(c1>0)
               {
                   a[i]=c1;
                   c0++;
                   c1--;
               }
               else
               {
                   c0++;c++;a[i]=c;
               }
           }
       }
       cout<<c<<endl;
       for(i=0;i<n;i++) cout<<a[i]<<" ";
       cout<<endl;
   }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        ll n,cnt=0;
        cin>>n;
        string s;
        cin>>s;
        n=s.size();
        vll ans(n,-1);
        for(ll i=0;i<n;)
        {
            if(s[i]=='0') {
                ans[i]=1;
                i++;
                ll k=2;
                while(i<n&&s[i]=='0') ans[i++]=k++;
            }
            else {
                ans[i]=1;
                i++;
                ll k=2;
                while(i<n&&s[i]=='1') ans[i++]=k++;
            }
        }
        rep(i,0,n) if(cnt<ans[i]) cnt=ans[i];
        cout<<cnt<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        ll n,cnt=1;
        cin>>n;
        string s;
        cin>>s;
        n=s.size();
        vll ans(n,-1);

        set<int> a[2];
        rep(i,0,n) a[s[i]-'0'].insert(i);

        while(!a[0].empty()&&!a[1].empty())
        {
            int chance=0,prev;
            if(*a[1].begin()<*a[0].begin())
                chance=1;

            ans[*a[chance].begin()]=cnt;
            prev=*a[chance].begin();
            a[chance].erase(prev);
            chance^=1;

            while(1) {
                auto it=lower_bound(all(a[chance]),prev);
                if(it!=a[chance].end()) ans[*it]=cnt;
                else break;
                prev=*it;
                a[chance].erase(prev);
                chance^=1;
            }
            cnt++;
        }
        rep(i,0,2)
        for(auto &it:a[i]) {
            ans[it]=cnt++;
        }

        cout<<cnt-1<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        ll n,cnt=1;
        cin>>n;
        string s;
        cin>>s;
        n=s.size();
        vll ans(n,-1);

        set<int> one,zero;
        rep(i,0,n) {
            if(s[i]=='0') zero.insert(i);
            else one.insert(i);
        }

        while(!one.empty()&&!zero.empty())
        {
            int chance,prev;

            if(*one.begin()<*zero.begin())
            {
                ans[*one.begin()]=cnt;
                chance=0;
                prev=*one.begin();
                one.erase(prev);
            }
            else {
                ans[*zero.begin()]=cnt;
                chance=1;
                prev=*zero.begin();
                zero.erase(prev);
            }
            while(1) {
                if(!chance) {
                    auto it=upper_bound(all(zero),prev);
                    if(it!=zero.end()) ans[*it]=cnt;
                    else break;
                    prev=*it;
                    zero.erase(prev);
                }
                else {
                    auto it=upper_bound(all(one),prev);
                    if(it!=one.end()) ans[*it]=cnt;
                    else break;
                    prev=*it;
                    one.erase(prev);
                }
                chance^=1;
            }
            cnt++;
        }
        for(auto &it:one) {
            ans[it]=cnt++;
        }
        for(auto &it:zero) {
            ans[it]=cnt++;
        }
        // rep(i,0,n) if(cnt<ans[i]) cnt=ans[i];
        cout<<cnt<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        int n,cnt=0,c=0,n0=1,n1=0;
        cin>>n;
        string s;
        cin>>s;
        vi ans(n,-1);
        while(cnt!=n) {
            char prev='X';
            rep(i,0,n) {
                if(ans[i]!=-1) continue;
                if(s[i]=='0') {
                    if(prev!='0') {
                        cnt++;
                        ans[i]=n0;
                    }
                }
                else {
                    if(prev!='1') {
                        cnt++;
                        ans[i]=n0;
                    }
                }
                prev=s[i];
            }
            n0++;
        }

        cout<<n0-1<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pidir<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_bidck
#define m_p midke_pidir
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define idll(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"

using namespace std;

const int N=2e5+5;
int ans[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        int n,num=1;
        cin>>n;
        string s;
        cin>>s;
        // n=s.size();
        // vi id(n);

        set<int> id[2];
        rep(i,0,n) id[s[i]-'0'].insert(i);

        while(!id[0].empty()&&!id[1].empty())
        {
            int z=0,cur=-1;
            if(*id[1].begin()<*id[0].begin())
                z=1;

            while(1) {
                auto it=id[z].lower_bound(cur);
                if(it!=id[z].end()) ans[*it]=num;
                else break;
                cur=*it;
                id[z].erase(cur);
                // ans[cur]=num;
                z=1-z;
            }
            num++;
        }
        rep(i,0,2)
        for(auto &it:id[i]) {
            ans[it]=num++;
        }

        cout<<num-1<<endl;
        rep(i,0,n) cout<<ans[i]<<" ";
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        int n,c=0,n0=0,n1=0;
        cin>>n;
        string s;
        cin>>s;
        vi ans(n,-1);
        rep(i,0,n) {
            if(s[i]=='0') {
                if(n0==0) {
                    ans[i]=++n1;
                }
                else ans[i]=n0--;
            }
            else {
                if(n1==0) {
                    ans[i]=++n0;
                }
                else ans[i]=n1--;
            }
            c=max(c,ans[i]);
        }
        cout<<c<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        int n,cnt=0;
        cin>>n;
        string s;
        cin>>s;
        vi ans(n,-1);
        for(int i=0;i<n;)
        {
            if(s[i]=='0') {
                ans[i]=1;
                i++;
                int k=2;
                while(i<n&&s[i]=='0') ans[i++]=k++;
            }
            else {
                ans[i]=1;
                i++;
                int k=2;
                while(i<n&&s[i]=='1') ans[i++]=k++;
            }
        }
        rep(i,0,n) cnt=max(cnt,ans[i]);
        cout<<cnt<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        int n,c=0,m=-1000;
        cin>>n;
        string s;
        cin>>s;
        vi ans(n,-1);
        rep(i,0,n) {
            if(s[i]=='0') {
                ans[i]=++c;
            }
            else ans[i]=c--;
            m=max(m,abs(ans[i]));
        }
        int cnt=0;
        rep(i,0,n) {
            if(ans[i]<=0) ans[i]+=m+1;
            cnt=max(cnt,ans[i]);
        }
        cout<<cnt<<endl;
        rep(i,0,n) cout<<ans[i]<<" ";
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        int n,c=0,m=-1000;
        cin>>n;
        string s;
        cin>>s;
        vi ans(n,-1);
        rep(i,0,n) {
            if(s[i]=='0') {
                ans[i]=++c;
            }
            else ans[i]=c--;
            m=max(m,abs(ans[i]));
        }
        rep(i,0,n) if(ans[i]<=0) cout<<ans[i]+m+1<<" "; else cout<<ans[i]<<" ";
        cout<<endl;
    }
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define vpll vector< pll >
#define vvi vector<vector<int> >
#define vi vector<int>
#define vb vector<bool>
#define vll vector<ll>
#define pb push_back
#define m_p make_pair
#define rep(i,a,b) for(ll (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(ll (i)=(a); (i) >= (b) ; (i)--)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define print(x)  for(auto &it:x)   cout<<it<<" ";
#define endl "\n"
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t=1;
    cin>>t;
    while(t--)
    {
        ll n,cnt=1;
        cin>>n;
        string s;
        cin>>s;
        n=s.size();
        vll ans(n,-1);

        set<int> one,zero;
        rep(i,0,n) {
            if(s[i]=='0') zero.insert(i);
            else one.insert(i);
        }

        while(!one.empty()&&!zero.empty())
        {
            int chance,prev;

            if(*one.begin()<*zero.begin())
            {
                ans[*one.begin()]=cnt;
                chance=0;
                prev=*one.begin();
                one.erase(prev);
            }
            else {
                ans[*zero.begin()]=cnt;
                chance=1;
                prev=*zero.begin();
                zero.erase(prev);
            }
            while(1) {
                if(!chance) {
                    auto it=upper_bound(all(zero),prev);
                    if(it!=zero.end()) ans[*it]=cnt;
                    else break;
                    prev=*it;
                    zero.erase(prev);
                }
                else {
                    auto it=upper_bound(all(one),prev);
                    if(it!=one.end()) ans[*it]=cnt;
                    else break;
                    prev=*it;
                    one.erase(prev);
                }
                chance^=1;
            }
            cnt++;
        }
        for(auto &it:one) {
            ans[it]=cnt++;
        }
        for(auto &it:zero) {
            ans[it]=cnt++;
        }
        // rep(i,0,n) if(cnt<ans[i]) cnt=ans[i];
        cout<<cnt-1<<endl;
        print(ans);
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		map<ll,ll>mp0;
		map<ll,ll>mp1;
		ll count=1;
		ll ans[n];
		if(s[0]=='0')
		{
			ans[0]=1;
			if(s[1]=='0')
				mp0[0]=count;
		}
		else
		{
			ans[0]=1;
			if(s[1]=='1')
				mp1[0]=count;
		}
		for(ll i=1;i<s.length();i++)
		{
			ll p;
			ll q;
			if(s[i]=='0')
				p=0;
			else
				p=1;
			if(s[i-1]=='0')
				q=0;
			else
				q=1;
			int x=p^q;
			//cout<<x<<endl;
			if(x==0 && s[i]=='0')
			{
				if(mp1.size()==0)
				{
				count++;
				ans[i]=count;
						mp0[i]=count;
				}
				else
				{
					auto it=mp1.begin();
					ans[i]=it->second;
					mp1.erase(it);
				}
			}
			if(x==0 && s[i]=='1')
			{
				if(mp0.size()==0)
				{
				count++;
				mp1[i]=count;
				ans[i]=count;

				}
				else
				{
					auto it=mp0.begin();
					ans[i]=it->second;
					mp0.erase(it);
				}
			}
			if(x==1)
			{
				ans[i]=ans[i-1];
			}
		}
		cout<<*max_element(ans,ans+n)<<endl;
		for(ll i=0;i<n;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		map<ll,ll>mp0;
		map<ll,ll>mp1;
		ll count=1;
		ll ans[n];
		if(s[0]=='0')
		{
			ans[0]=1;
			if(s[1]=='0')
				mp0[0]=count;
		}
		else
		{
			ans[0]=1;
			if(s[1]=='1')
				mp1[0]=count;
		}
		for(ll i=1;i<s.length();i++)
		{
			ll p;
			ll q;
			if(s[i]=='0')
				p=0;
			else
				p=1;
			if(s[i-1]=='0')
				q=0;
			else
				q=1;
			int x=p^q;
			//cout<<x<<endl;
			if(x==0 && s[i]=='0')
			{
				if(mp1.size()==0)
				{
				count++;
				ans[i]=count;
				//mp0[i]=count;
				}
				else
				{
					auto it=mp1.begin();
					ans[i]=it->second;
					mp1.erase(it);
				}
			}
			if(x==0 && s[i]=='1')
			{
				if(mp0.size()==0)
				{
				count++;
				//mp1[i]=count;
				ans[i]=count;
				}
				else
				{
					auto it=mp0.begin();
					ans[i]=it->second;
					mp0.erase(it);
				}
			}
			if(x==1)
			{
				ans[i]=ans[i-1];
			}
		}
		cout<<*max_element(ans,ans+n)<<endl;
		for(ll i=0;i<n;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		map<ll,ll>mp0;
		map<ll,ll>mp1;
		ll count=1;
		ll ans[n];
		if(s[0]=='0')
		{
			ans[0]=1;
			mp0[0]=count;
		}
		else
		{
			ans[0]=1;
			mp1[0]=count;
		}
		for(ll i=1;i<s.length();i++)
		{
			ll p;
			ll q;
			if(s[i]=='0')
				p=0;
			else
				p=1;
			if(s[i-1]=='0')
				q=0;
			else
				q=1;
			int x=p^q;
			//cout<<x<<endl;
			if(x==0 && s[i-1]=='0')
			{
				if(mp1.size()==0)
				{
				count++;
				ans[i]=count;
						mp0[i]=count;
				}
				else
				{
					auto it=mp1.begin();
					ans[i]=it->second;
					mp1.erase(it);
				}
			}
			if(x==0 && s[i-1]=='1')
			{
				if(mp0.size()==0)
				{
						count++;
				mp1[i]=count;
				ans[i]=count;

				}
				else
				{
					auto it=mp0.begin();
					ans[i]=it->second;
					mp0.erase(it);
				}
			}
			if(x==1)
			{
				ans[i]=ans[i-1];
			}
		}
		for(ll i=0;i<n;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		ll c=0,c1=0,c0=0;
		vector<ll>vec;
		for(ll i=0;i<n;i++)
		{
			if(s[i]=='0')
			{
				if(c1>0)
				{
					vec.push_back(c-c0);
					c0++;
					c1--;
				}
				else
				{
					c++;
					vec.push_back(c);
					c0++;
				}
			}
			else
			{
				if(c0>0)
				{
					vec.push_back(c1+1);
					c1++;
					c0--;
				}
				else
				{
					c++;
					vec.push_back(c);
					c1++;
				}
			}
		}
		cout<<c<<endl;
		for(ll i=0;i<vec.size();i++)
			cout<<vec[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		map<ll,ll>mp0;
		map<ll,ll>mp1;
		ll count=1;
		ll ans[n];
		if(s[0]=='0')
		{
			ans[0]=1;
			mp0[0]=count;
		}
		else
		{
			ans[0]=1;
			mp1[0]=count;
		}
		for(ll i=1;i<s.length();i++)
		{
			ll p;
			ll q;
			if(s[i]=='0')
				p=0;
			else
				p=1;
			if(s[i-1]=='0')
				q=0;
			else
				q=1;
			int x=p^q;
			//cout<<x<<endl;
			if(x==0 && s[i-1]=='0')
			{
				if(mp1.size()==0)
				{
				count++;
				ans[i]=count;
						mp0[i]=count;
				}
				else
				{
					auto it=mp1.begin();
					ans[i]=it->second;
					mp1.erase(it);
				}
			}
			if(x==0 && s[i-1]=='1')
			{
				if(mp0.size()==0)
				{
						count++;
				mp1[i]=count;
				ans[i]=count;

				}
				else
				{
					auto it=mp0.begin();
					ans[i]=it->second;
					mp0.erase(it);
				}
			}
			if(x==1)
			{
				ans[i]=ans[i-1];
			}
		}
		cout<<*max_element(ans,ans+n)<<endl;
		for(ll i=0;i<n;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		ll c=0,c1=0,c0=0;
		vector<ll>vec;
		for(ll i=0;i<n;i++)
		{
			if(s[i]=='0')
			{
				if(c1>0)
				{
					vec.push_back(c-c0);
					c0++;
					c1--;
				}
				else
				{
					c++;
					vec.push_back(c);
					c0++;
				}
			}
			else
			{
				if(c0>0)
				{
					vec.push_back(c-c1);
					c1++;
					c0--;
				}
				else
				{
					c++;
					vec.push_back(c);
					c1++;
				}
			}
		}
		cout<<c<<endl;
		for(ll i=0;i<vec.size();i++)
			cout<<vec[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		map<ll,ll>mp0;
		map<ll,ll>mp1;
		ll count=1;
		ll ans[n];
		if(s[0]=='0')
		{
			ans[0]=1;
			if(s[1]=='0')
				mp0[0]=count;
		}
		else
		{
			ans[0]=1;
			if(s[1]=='1')
				mp1[0]=count;
		}
		for(ll i=1;i<s.length();i++)
		{
			ll p;
			ll q;
			if(s[i]=='0')
				p=0;
			else
				p=1;
			if(s[i-1]=='0')
				q=0;
			else
				q=1;
			int x=p^q;
			//cout<<x<<endl;
			if(x==0 && s[i-1]=='0')
			{
				if(mp1.size()==0)
				{
				mp0[i-1]=count;
				count++;
				ans[i]=count;
				}
				else
				{
					auto it=mp1.begin();
					ans[i]=it->second;
					mp1.erase(it);
				}
			}
			if(x==0 && s[i]=='1')
			{
				if(mp0.size()==0)
				{
				mp1[i-1]=count;
				count++;
				ans[i]=count;
				}
				else
				{
					auto it=mp0.begin();
					ans[i]=it->second;
					mp0.erase(it);
				}
			}
			if(x==1)
			{
				ans[i]=ans[i-1];
			}
		}
		cout<<*max_element(ans,ans+n)<<endl;
		for(ll i=0;i<n;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define ll long long int
int main()
{
	SPEED;
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		string s;
		cin>>s;
		map<ll,ll>mp0;
		map<ll,ll>mp1;
		ll count=1;
		ll ans[n];
		if(s[0]=='0')
		{
			ans[0]=1;
			if(s[1]=='0')
				mp0[0]=count;
		}
		else
		{
			ans[0]=1;
			if(s[1]=='1')
				mp1[0]=count;
		}
		for(ll i=1;i<s.length();i++)
		{
			ll p;
			ll q;
			if(s[i]=='0')
				p=0;
			else
				p=1;
			if(s[i-1]=='0')
				q=0;
			else
				q=1;
			int x=p^q;
			//cout<<x<<endl;
			if(x==0 && s[i]=='0')
			{
				if(mp1.size()==0)
				{
				mp0[i-1]=count;
				count++;
				ans[i]=count;
				}
				else
				{
					auto it=mp1.begin();
					ans[i]=it->second;
					mp1.erase(it);
				}
			}
			if(x==0 && s[i]=='1')
			{
				if(mp0.size()==0)
				{
				mp1[i-1]=count;
				count++;
				ans[i]=count;
				}
				else
				{
					auto it=mp0.begin();
					ans[i]=it->second;
					mp0.erase(it);
				}
			}
			if(x==1)
			{
				ans[i]=ans[i-1];
			}
		}
		cout<<*max_element(ans,ans+n)<<endl;
		for(ll i=0;i<n;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


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

int main()
{
    int t,n,i,j,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v;
        j=1,mx=INT_MIN;

        v.push_back(1);

        for(i=1;i<n;i++){
            if(s[i]!=s[i-1]){
                j=1;
            }
            else{
                j++;
            }
            v.push_back(j);
            mx=max(mx,j);
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }
    return 0;
}


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

int main()
{
    int t,n,i,c0,c1,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v;
        mx=1,c0=0,c1=0;

        for(i=0;i<n;i++){
            if(s[i]=='0'){
                c0++;
                if(c1>0){
                    v.push_back(c1);
                    c1--;
                }
                else{
                    v.push_back(c0);
                }
            }
            else{
                c1++;
                if(c0>0){
                    v.push_back(c0);
                    c0--;
                }
                else{
                    v.push_back(c1);
                }
            }
            mx=max(mx,max(c0,c1));
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }
    return 0;
}


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

int main()
{
    int t,n,i,j,k,c0,c1,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v;
        mx=1,c0=0,c1=0,j=1,k=1;

        for(i=0;i<n;i++){
            if(s[i]=='0'){
                c0++;
                if(c1>0){
                    v.push_back(j++);
                    c1--;
                    if(c1==0){
                        j=1;
                    }
                }
                else{
                    v.push_back(c0);
                }
            }
            else{
                c1++;
                if(c0>0){
                    v.push_back(k++);
                    c0--;
                    if(c0==0){
                        k=1;
                    }
                }
                else{
                    v.push_back(c1);
                }
            }
            mx=max(mx,v.back());
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }

    return 0;
}


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

int main()
{
    int t,n,i,j,k,c0,c1,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v;
        mx=1,c0=0,c1=0,j=1,k=1;

        for(i=0;i<n;i++){
            if(s[i]=='0'){
                c0++;
                if(c1>0){
                    v.push_back(j++);
                    c1--;
                    if(c1==0){
                        j=1;
                    }
                }
                else{
                    v.push_back(c0);
                }
            }
            else{
                c1++;
                if(c0>0){
                    v.push_back(k++);
                    c0--;
                    if(c0==0){
                        k=1;
                    }
                }
                else{
                    v.push_back(c1);
                }
            }
            mx=max(mx,max(c0,c1));
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }

    return 0;
}


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

int main()
{
    int t,n,i,c0,c1,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v,v0,v1;
        mx=0,c0=0,c1=0;

        for(i=0;i<n;i++){
            if(s[i]=='0'){
                if(v1.size()>0){
                    v.push_back(v1.back());
                    v0.push_back(v1.back());
                    v1.pop_back();

                }
                else{
                    v0.push_back(++mx);
                    v.push_back(mx);

                }
            }
            else{
                if(v0.size()>0){
                    v.push_back(v0.back());
                    v1.push_back(v0.back());
                    v0.pop_back();
                }
                else{
                    v1.push_back(++mx);
                    v.push_back(mx);
                }
            }
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }
    return 0;
}


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

int main()
{
    int t,n,i,j,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v;
        j=1,mx=1;

        v.push_back(1);

        for(i=1;i<n;i++){
            if(s[i]!=s[i-1]){
                j=1;
            }
            else{
                j++;
            }
            v.push_back(j);
            mx=max(mx,j);
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }
    return 0;
}


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

int main()
{
    int t,n,i,c0,c1,mx;
    string s;

    cin>>t;

    while(t--){
        scanf("%d",&n);

        cin>>s;

        vector<int>v;
        mx=1,c0=0,c1=0;

        for(i=0;i<n;i++){
            if(s[i]=='0'){
                c0++;
                v.push_back(c0);
                c1=0;
            }
            else{
                c1++;
                v.push_back(c1);
                c0=0;
            }
            mx=max(mx,max(c0,c1));
        }
        printf("%d\n",mx);
        for(i=0;i<n;i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
int main(void)
{
   ll t,n;
   string s;
   cin>>t;
   while(t--)
   {
      vector<ll> v;
      cin>>n;
      cin>>s;
      ll one=0,zero=0,str1=0,str0=0,mx0=0,mx1=0;
      for(ll i=0;i<n;i++)
      {
         if(s[i]=='1')
         {
            zero=0;
            if(str0!=0)
               str0--;
            else
               one=mx1;
            one++;
            str1++;
            //str1=one;
            mx1=max(mx1,one);
            v.push_back(one);
            if(i!=n-1 && s[i+1]=='0')
               str0=0;
         }
         else
         {
            one=0;
            if(str1!=0)
               str1--;
            else
               zero=mx0;
            zero++;
            str0++;
            //str0=zero;
            mx0=max(mx0,zero);
            v.push_back(zero);
            if(i!=n-1 && s[i+1]=='1')
               str1=0;
         }
      }
      cout<<max(mx0,mx1)<<endl;
      for(ll i=0;i<n;i++)
         cout<<v[i]<<" ";
      cout<<endl;
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(void)
{
   int t,n;
   string s;
   cin>>t;
   while(t--)
   {
      int seq[200005]={};
      set<int> st1,st0;
      set<int>::iterator it0,it1;
      cin>>n;
      cin>>s;
      for(int i=0;i<n;i++)
      {
         if(s[i]=='1')
            st1.insert(i);
         else
            st0.insert(i);
      }
      int cnt=1;
      while(st1.size()!=0 || st0.size()!=0)
      {
         if(st0.size()==0)
         {
            while(st1.size()!=0)
            {
               it1=st1.begin();
               seq[*it1]=cnt;
               cnt++;
               st1.erase(it1);
            }
            break;
         }
         if(st1.size()==0)
         {
            while(st0.size()!=0)
            {
               it0=st0.begin();
               seq[*it0]=cnt;
               cnt++;
               st0.erase(it0);
            }
            break;
         }
         //else
         {
            it0=st0.begin();
            it1=st1.begin();
            if(*it0<*it1)
            {
               seq[*it0]=cnt;
               st0.erase(it0);
               int c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it0=st0.upper_bound(*it1);
                     if(it0==st0.end())
                        break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  else
                  {
                     it1=st1.upper_bound(*it0);
                     if(it1==st1.end())
                        break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  c++;
               }
            }
            else
            {
               seq[*it1]=cnt;
               st1.erase(it1);
               int c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it1=st1.upper_bound(*it0);
                     if(it1==st1.end())
                        break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  else
                  {
                     it0=st0.upper_bound(*it1);
                     if(it0==st0.end())
                        break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  c++;
               }
            }
            cnt++;
         }
      }
      cout<<cnt-1<<endl;
      for(int i=0;i<n;i++)
         cout<<seq[i]<<" ";
      cout<<endl;
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);
#define       RESET(a, b)        memset(a, b, sizeof(a))
#define       gcd(a, b)          __gcd(a, b)
#define       MX                 200005
bool cmp(long long int x,long long int y)
{
   return x>y;
}
int main(void)
{
   long long int t,n,m,k,x,y,a[200001];
   vector<ll> v,v1,v2;
   vector< pair <ll,ll> >p,p1,p2;
   set<ll> st;
   priority_queue<ll> pq;
   priority_queue< ll,vector<ll>,greater<ll> > lpq;
   priority_queue< pair<ll,ll> > phpq;
   string s,str;
   cin>>t;
   while(t--)
   {
      vector< pair <ll,ll> >p1,p2;
      vector< pair <char,ll> >sp;
      vector< pair <char,ll> >::iterator it;
      priority_queue< pair<ll,ll>,vector< pair<ll,ll> >,greater< pair <ll,ll> > > plpq;
      cin>>n;
      cin>>s;
      str=s;
      ll one=0,zero=0,flag,cnt1=1,cnt2=1;
      for(ll i=0;i<n;i++)
      {
         if(s[i]=='1')
         one++;
         else
         zero++;
         sp.push_back(make_pair(s[i],i));
      }
      while(sp.size()!=0 && zero!=0)
      {
         flag=0;
         for(ll i=0;i<sp.size();i++)
         {
            if(flag==0 && zero==0)
               break;
            if(flag==1 && one==0)
               break;
            if(flag==0 && sp[i].first=='0')
            {
               flag=1;
               zero--;
               p1.push_back(make_pair(sp[i].second,cnt1));
               it=sp.begin()+i;
               sp.erase(it);
               i--;
            }
            else if(flag==1 && sp[i].first=='1')
            {
               flag=0;
               one--;
               p1.push_back(make_pair(sp[i].second,cnt1));
               it=sp.begin()+i;
               sp.erase(it);
               i--;
            }
         }
         //cout<<sp<<endl;
         cnt1++;
      }
      if(sp.size()==0)
         plpq.push(make_pair(cnt1-1,1));
      //cout<<cnt1-1<<endl;
      sp.clear();
      one=0,zero=0;
      for(ll i=0;i<n;i++)
      {
         if(s[i]=='1')
         one++;
         else
         zero++;
         sp.push_back(make_pair(s[i],i));
      }
      while(sp.size()!=0 && one!=0)
      {
         flag=1;
         for(ll i=0;i<sp.size();i++)
         {
            if(flag==0 && zero==0)
               break;
            if(flag==1 && one==0)
               break;
            if(flag==0 && sp[i].first=='0')
            {
               flag=1;
               zero--;
               p2.push_back(make_pair(sp[i].second,cnt2));
               it=sp.begin()+i;
               sp.erase(it);
               i--;
            }
            else if(flag==1 && sp[i].first=='1')
            {
               flag=0;
               one--;
               p2.push_back(make_pair(sp[i].second,cnt2));
               it=sp.begin()+i;
               sp.erase(it);
               i--;
            }
         }
         //cout<<sp<<endl;
         cnt2++;
      }
      if(sp.size()==0)
         plpq.push(make_pair(cnt2-1,2));
      //cout<<cnt2-1<<endl;
      cout<<plpq.top().first<<endl;
      if(plpq.top().second==1)
      {
         sort(p1.begin(),p1.end());
         for(ll i=0;i<p1.size();i++)
            cout<<p1[i].second<<" ";
         cout<<endl;
      }
      else
      {

         sort(p2.begin(),p2.end());
         for(ll i=0;i<p2.size();i++)
            cout<<p2[i].second<<" ";
         cout<<endl;
      }
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
int main(void)
{
   ll t,n;
   string s;
   cin>>t;
   while(t--)
   {
      //vector<ll> v;
      ll seq[200005]={};
      set<ll> st1,st0;
      set<ll>::iterator it0,it1;
      cin>>n;
      cin>>s;
      for(ll i=0;i<n;i++)
      {
         if(s[i]=='1')
            st1.insert(i);
         else
            st0.insert(i);
      }
      ll cnt=1;
      while(st1.size()!=0 || st0.size()!=0)
      {
         if(st0.size()==0)
         {
            while(st1.size()!=0)
            {
               it1=st1.begin();
               seq[*it1]=cnt;
               cnt++;
               st1.erase(it1);
            }
         }
         else if(st1.size()==0)
         {
            while(st0.size()!=0)
            {
               it0=st0.begin();
               seq[*it0]=cnt;
               cnt++;
               st0.erase(it0);
            }
         }
         else
         {
            it0=st0.begin();
            it1=st1.begin();
            if(*it0<*it1)
            {
               //it0=st0.begin();
               seq[*it0]=cnt;
               st0.erase(it0);
               ll c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it0=st0.upper_bound(*it1);
                     if(it0==st0.end())
                     break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  else
                  {
                     it1=st1.upper_bound(*it0);
                     if(it1==st1.end())
                     break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  c++;
               }
            }
            else
            {
               seq[*it1]=cnt;
               st1.erase(it1);
               ll c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it1=st1.upper_bound(*it0);
                     if(it1==st1.end())
                     break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  else
                  {
                     it0=st0.upper_bound(*it1);
                     if(it0==st0.end())
                     break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  c++;
               }
            }
            cnt++;
         }
      }
      cout<<cnt-1<<endl;
      for(ll i=0;i<n;i++)
         cout<<seq[i]<<" ";
      cout<<endl;
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
ll seq[200005];
int main(void)
{
   ll t,n;
   string s;
   cin>>t;
   while(t--)
   {
      set<ll> st1,st0;
      set<ll>::iterator it0,it1;
      cin>>n;
      cin>>s;
      for(ll i=0;i<n;i++)
      {
         if(s[i]=='1')
            st1.insert(i);
         else
            st0.insert(i);
      }
      ll cnt=1;
      while(1)
      {
         if(st0.size()==0)
         {
            while(st1.size()!=0)
            {
               it1=st1.begin();
               seq[*it1]=cnt;
               cnt++;
               st1.erase(it1);
            }
         }
         else if(st1.size()==0)
         {
            while(st0.size()!=0)
            {
               it0=st0.begin();
               seq[*it0]=cnt;
               cnt++;
               st0.erase(it0);
            }
         }
         else
         {
            it0=st0.begin();
            it1=st1.begin();
            if(*it0<*it1)
            {
               //it0=st0.begin();
               seq[*it0]=cnt;
               st0.erase(it0);
               ll c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it0=st0.upper_bound(*it1);
                     if(it0==st0.end())
                     break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  else
                  {
                     it1=st1.upper_bound(*it0);
                     if(it1==st1.end())
                     break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  c++;
               }
            }
            else
            {
               seq[*it1]=cnt;
               st1.erase(it1);
               ll c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it1=st1.upper_bound(*it0);
                     if(it1==st1.end())
                     break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  else
                  {
                     it0=st0.upper_bound(*it1);
                     if(it0==st0.end())
                     break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  c++;
               }
            }
            cnt++;
         }
         if(st1.size()==0 && st0.size()==0)
            break;
      }
      cout<<cnt-1<<endl;
      for(ll i=0;i<n;i++)
         cout<<seq[i]<<" ";
      cout<<endl;
   }
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
int seq[200001];
set<int> st1,st0;
set<int>::iterator it0,it1;
int main(void)
{
   int t,n;
   string s;
   cin>>t;
   while(t--)
   {
      cin>>n;
      cin>>s;
      for(int i=0;i<n;i++)
      {
         if(s[i]=='1')
            st1.insert(i);
         else
            st0.insert(i);
      }
      int cnt=1;
      while(st1.size()!=0 || st0.size()!=0)
      {
         if(st0.size()==0)
         {
            while(st1.size()!=0)
            {
               it1=st1.begin();
               seq[*it1]=cnt;
               cnt++;
               st1.erase(it1);
            }
            break;
         }
         if(st1.size()==0)
         {
            while(st0.size()!=0)
            {
               it0=st0.begin();
               seq[*it0]=cnt;
               cnt++;
               st0.erase(it0);
            }
            break;
         }
         //else
         {
            it0=st0.begin();
            it1=st1.begin();
            if(*it0<*it1)
            {
               seq[*it0]=cnt;
               st0.erase(it0);
               int c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it0=st0.lower_bound(*it1);
                     if(it0==st0.end())
                        break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  else
                  {
                     it1=st1.lower_bound(*it0);
                     if(it1==st1.end())
                        break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  c++;
               }
            }
            else
            {
               seq[*it1]=cnt;
               st1.erase(it1);
               int c=0;
               while(1)
               {
                  if(c%2!=0)
                  {
                     it1=st1.lower_bound(*it0);
                     if(it1==st1.end())
                        break;
                     seq[*it1]=cnt;
                     st1.erase(it1);
                  }
                  else
                  {
                     it0=st0.lower_bound(*it1);
                     if(it0==st0.end())
                        break;
                     seq[*it0]=cnt;
                     st0.erase(it0);
                  }
                  c++;
               }
            }
            cnt++;
         }
      }
      cout<<cnt-1<<endl;
      for(int i=0;i<n;i++)
         cout<<seq[i]<<" ";
      cout<<endl;
   }
   return 0;
}