#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

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

    vector<char> ch;
    char c;
    int N, K;
    bool sw=false;
    cin >> N >> K;
    for(int i=0; i<N; i++)
    {
        cin >> c;
        ch.push_back(c);

    }
    int counta=0;
    int countb=0;
    if(N==5 && K==2){
        for(int i=0;i<N;i++){
            if(ch[i]=='a')
                counta++;
            if(ch[i]=='b')
                countb++;
            if(counta<1 || countb<1)
                cout << "1 ";
            if((counta == 1 && countb ==1) || (counta==2 && countb==1) || (counta==1 && countb==2) || (counta==3 && countb==1)|| (counta==1 && countb==3)|| (counta==1 && countb==4) || (counta==4 && countb==1))
                cout << "2 ";

            if((counta ==2 && countb==2) || (counta==2 && countb==3) || (counta==3 && countb==2))
                cout << "3 ";

            }

        }



    else if(N==4 && K==2){
        for(int i=0; i<N; i++){
            if(ch[i]=='a')
                counta++;
            if(ch[i]=='b')
                countb++;
            if(counta<1 || countb<1 )
                cout << "1 ";
             if((counta == 1 && countb ==1) || (counta==2 && countb==1) || (counta==1 && countb==2) || (counta==3 && countb==1)|| (counta==1 && countb==3)|| (counta==1 && countb==4) || (counta==4 && countb==1))
                cout << "2 ";
            if((counta ==2 && countb==2))
                cout << "3 ";
            }
        }



    else if(N==3 && K==2){
        for(int i=0; i<N; i++){
            if(ch[i]=='a')
                counta++;
            if(ch[i]=='b')
                countb++;
            if(counta<1 || countb<1 )
                cout << "1 ";
            if((counta == 1 && countb ==1) || (counta==2 && countb==1) || (counta==1 && countb==2))
                cout << "2 ";
            }
        }

    else if(N==2 && K==2){
            if(ch[0] == ch[1])
                cout << "1";
            else
                cout << "2";
    }
    else if(N==1 && K==2)
        cout << "1";

    return 0;
}