#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define itn int
#define rep2(i,a,n) for(int i = (a);i < (n);i++)
#define rep(i,n) rep2(i,0,n)

int main(void){
    string s,t;
    cin >> s >> t;
    if(s == "Y"){
        if(t == "a")cout << "A";
        else if(t == "b")cout << "B";
        else cout << "C";
    } else cout << t;
    
    
    
}
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
#define ll long long
using namespace std;
int n;ll k,s3[3000010],s2[3000010],f2[3000010],s[1000010];
void solve1(int sum,int fir,ll k)
{
	ll sec=max(1ll,sum-fir-n)+k-1;
	printf("%lld %lld %lld",fir,sec,sum-fir-sec);
	exit(0);
}
void solve(int sum,ll k)
{
	for(int i=1;i<=n;i++)
	{
		s[i]=s[i-1]+f2[sum-i];
		if(s[i]>=k)
			solve1(sum,i,k-s[i-1]);
	}
}
signed main()
{
	scanf("%lld %lld",&n,&k);
	for(int i=2;i<=2*n;i++)
	{
		f2[i]=n-abs(i-(n+1));
		s2[i]=s2[i-1]+f2[i];
	}
	for(int i=2*n+1;i<=3*n;i++)
		s2[i]=s2[i-1];
	for(int i=3;i<=3*n;i++)
		s3[i]=s3[i-1]+s2[i-1]-s2[max(0ll,i-n-1)];
	for(int i=3;i<=3*n;i++)
		if(s3[i]>=k)
			solve(i,k-s3[i-1]);
}