#include<cstdio>
#include<cstring>
using namespace std;
char str[14][14];
int main(){
    int i;
    while(scanf("%s",str[0])!=EOF){
        for(i=1;i<14;i++){
            scanf("%s",str[i]);
        }
        int flag1=1,flag2=1;
        int s=0,p=0,w=0;
        for(i=0;i<14;i++){
            if(str[i][1]=='s') s++;
            else if(str[i][1]=='p') p++;
            else if(str[i][1]=='w') w++;
        }
        if(s==14||p==14||w==14){
                //puts("done");
            int a[20]={0};
            for(i=0;i<14;i++){
                a[str[i][0]-'0']++;
            }
        //for(i=1;i<=9;i++) printf("%d\n",a[i]);
            if(a[1]>=3&&a[9]>=3){
                for(i=2;i<=8;i++){
                    if(a[i]==0) {flag2=0;break;}
                }
            }
            else {
                flag2=0;
            }
            if (flag2==1) {printf("jiulianbaodeng!\n");continue;}
        }
        else {
            int b[6][6]={0};
            int c[10]={0};
            int cnt=0;
            for(i=0;i<14;i++){
                if(strcmp(str[i],"dong")==0) c[1]++;
                else if(strcmp(str[i],"xi")==0) c[2]++;
                else if(strcmp(str[i],"nan")==0) c[3]++;
                else if(strcmp(str[i],"bei")==0) c[4]++;
                else if(strcmp(str[i],"zhong")==0) c[5]++;
                else if(strcmp(str[i],"fa")==0) c[6]++;
                else if(strcmp(str[i],"bai")==0) c[7]++;
                else if(str[i][0]=='1'&&str[i][1]=='s') b[1][1]++;
                else if(str[i][0]=='1'&&str[i][1]=='p') b[1][2]++;
                else if(str[i][0]=='1'&&str[i][1]=='w') b[1][3]++;
                else if(str[i][0]=='9'&&str[i][1]=='s') b[2][1]++;
                else if(str[i][0]=='9'&&str[i][1]=='p') b[2][2]++;
                else if(str[i][0]=='9'&&str[i][1]=='w') b[2][3]++;
            }
            for(i=1;i<=7;i++){
                cnt+=c[i];
            }
            for(i=1;i<=3;i++){
                cnt+=b[1][i]+b[2][i];
            }
            if(cnt<=13) flag1=0;
            for(i=1;i<=7;i++){
                if(c[i]==0){flag1=0;break;}
            }
            for(i=1;i<=3;i++){
                if(b[1][i]==0||b[2][i]==0){
                    flag1=0;break;
                }
            }
            if(flag1==1){
                printf("shisanyao!\n");
                continue;
            }
        }
        printf("I dont know!\n");
    }
    return 0;
}

Problem Description

Mahjong is a board game with a long history. But Mahjong has different rules in different city.

A deck of mahjong consists of 136 cards. It contains 1-9 card in three suits,and Seven kinds of word card("dong","nan","xi","bei",“zhong”,"fa","bai"),there are 4 same cards for each kind of card in a deck of mahjong .

In a mysterious country, the rules of mahjong are very simple.In the game,each Player has 14 cards.There are only two ways people can win the game:



1. shisanyao:You should have all 1 and 9 card in three suits and seven kinds of word card at the same time,and an extra card with any kind of 1 and 9 or word.

2. jiulianbaodeng:Firstly,You should make sure that you have the same suit in your hand.Secondly, for card "1" and card "9",you should have at least three . but for card "2" to card "8",at least one.For example, both "11112345678999" and "11122345678999" can win the game.



Now you know a player's 14 cards. Please judge which card type he can use to win the game.

 

 

Input

The input file contains 14 lines.Each line has a string representing a card.

For three suits of card "1" to card "9",We use two characters for the type,the first character a is number 1 to 9,and the second character b represents the suit.(a∈{1,2,3,4,5,6,7,8,9},b∈{s,p,w})

For the word cards,as shown in the description,we use full spelling pinyin represent them.

 

 

Output

If player ‘s card meet the “shisanyao” condition, you should output "shisanyao!".

If player ‘s card meet the “jiulianbaodeng” condition, you should output "jiulianbaodeng!".

Otherwise,you should output "I dont know!".

 

 

Sample Input


 

1w 5w 2w 6w 5w 9w 9w 7w 1w 3w 9w 4w 1w 8w

 

 

Sample Output


 

jiulianbaodeng!

思路:模拟就好了

#include<cstdio>
#include<cstring>
using namespace std;
char str[14][14];
int main(){
    int i;
    while(scanf("%s",str[0])!=EOF){
        for(i=1;i<14;i++){
            scanf("%s",str[i]);
        }
        int flag1=1,flag2=1;
        int s=0,p=0,w=0;
        for(i=0;i<14;i++){
            if(str[i][1]=='s') s++;
            else if(str[i][1]=='p') p++;
            else if(str[i][1]=='w') w++;
        }
        if(s==14||p==14||w==14){
                //puts("done");
            int a[20]={0};
            for(i=0;i<14;i++){
                a[str[i][0]-'0']++;
            }
        //for(i=1;i<=9;i++) printf("%d\n",a[i]);
            if(a[1]>=3&&a[9]>=3){
                for(i=2;i<=8;i++){
                    if(a[i]==0) {flag2=0;break;}
                }
            }
            else {
                flag2=0;
            }
            if (flag2==1) {printf("jiulianbaodeng!\n");continue;}
        }
        else {
            int b[6][6]={0};
            int c[10]={0};
            int cnt=0;
            for(i=0;i<14;i++){
                if(strcmp(str[i],"dong")==0) c[1]++;
                else if(strcmp(str[i],"xi")==0) c[2]++;
                else if(strcmp(str[i],"nan")==0) c[3]++;
                else if(strcmp(str[i],"bei")==0) c[4]++;
                else if(strcmp(str[i],"zhong")==0) c[5]++;
                else if(strcmp(str[i],"fa")==0) c[6]++;
                else if(strcmp(str[i],"bai")==0) c[7]++;
                else if(str[i][0]=='1'&&str[i][1]=='s') b[1][1]++;
                else if(str[i][0]=='1'&&str[i][1]=='p') b[1][2]++;
                else if(str[i][0]=='1'&&str[i][1]=='w') b[1][3]++;
                else if(str[i][0]=='9'&&str[i][1]=='s') b[2][1]++;
                else if(str[i][0]=='9'&&str[i][1]=='p') b[2][2]++;
                else if(str[i][0]=='9'&&str[i][1]=='w') b[2][3]++;
            }
            for(i=1;i<=7;i++){
                cnt+=c[i];
            }
            for(i=1;i<=3;i++){
                cnt+=b[1][i]+b[2][i];
            }
            if(cnt<=13) flag1=0;
            for(i=1;i<=7;i++){
                if(c[i]==0){flag1=0;break;}
            }
            for(i=1;i<=3;i++){
                if(b[1][i]==0||b[2][i]==0){
                    flag1=0;break;
                }
            }
            if(flag1==1){
                printf("shisanyao!\n");
                continue;
            }
        }
        printf("I dont know!\n");
    }
    return 0;
}