#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,cntr=0;
cin >> n;
char arr[n+1];
string s;
for(int i = 1; i <= n ;i++)
{
cntr=0;
cin >> s;
for(int j = 0 ; j < s.size() ;j++)
{
if(s[j]=='B')
cntr++;
}
if(2*cntr >= s.size()-1 && cntr!=s.size()-1 )
arr[i]='Y';
else
arr[i]='N';
}
for(int i =1 ; i<=n;i++)
{
cout << "Case #" << i << ": " << arr[i] << "\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKaW50IG1haW4oKQp7CiAgICBsbCBuLGNudHI9MDsKICAgIGNpbiA+PiBuOwogICAgY2hhciBhcnJbbisxXTsKICAgIHN0cmluZyBzOwogICAgZm9yKGludCBpID0gMTsgaSA8PSBuIDtpKyspCiAgICB7CiAgICAgICAgY250cj0wOwogICAgICAgIGNpbiA+PiBzOwogICAgICAgIGZvcihpbnQgaiA9IDAgOyBqIDwgcy5zaXplKCkgO2orKykKICAgICAgICB7CiAgICAgICAgICAgIGlmKHNbal09PSdCJykKICAgICAgICAgICAgICAgIGNudHIrKzsKCiAgICAgICAgfQogICAgICAgIGlmKDIqY250ciA+PSBzLnNpemUoKS0xICYmIGNudHIhPXMuc2l6ZSgpLTEgKQogICAgICAgICAgICBhcnJbaV09J1knOwogICAgICAgIGVsc2UKICAgICAgICAgICAgYXJyW2ldPSdOJzsKICAgIH0KICAgIGZvcihpbnQgaSA9MSA7IGk8PW47aSsrKQogICAgewogICAgICAgIGNvdXQgPDwgIkNhc2UgIyIgPDwgaSA8PCAiOiAiIDw8IGFycltpXSA8PCAiXG4iOwogICAgfQogICAgcmV0dXJuIDA7Cn0=