#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>

using namespace std;

int main()
{


    int n, k;
    char pom;
    scanf("%d%d%c", &n, &k, &pom);


    char rec[n];
    gets(rec);

    if(n<=5 && k == 2)
    {
        int cnta, cntb;

        cnta = 0; cntb = 0;

        for(int i = 0; i < n; i++)
        {
            if(rec[i] == 'a') cnta++; else cntb++;
            if(cnta == 0 || cntb == 0) printf("1 ");
            else if(cnta < 2 || cntb < 2) printf("2 ");
            else printf("3 ");
        }

        return 0;

    }
    int jesuIsti = 1;
    printf("1 ");
    for(int i = 1; i < n; i++)
    {
        if(rec[i-1] == rec[i] && jesuIsti == 1) jesuIsti ==1;
        if(jesuIsti)
        {
            printf("1 ");
        }
        else printf("2 ");
        
        
    }
    return 0;
}