void main()
{

	char str[300];
	char stemp[300];
	int i,j;
	int itemp[300];
	int count;
	char c;

	scanf("%s",str);
	memset(stemp,0,300);
    j=0;
    for(i=0;i<strlen(str);i++)
	{
        if(str[i]>=97 && str[i]<=122)//???????
		{

         stemp[j]=str[i];
         j++;

		}

	}
    if(j==0)
		printf("No");
	//??stemp??????????????
   for(i=0;i<strlen(stemp);i++)
	   itemp[i]=0;

   //???stemp??????

   for(i=1;i<=strlen(stemp);i++)
	   for(j=0;j<strlen(stemp)-i;j++)
	   {
           if(stemp[j]>stemp[j+1])
		   {
             c=stemp[j+1];
			 stemp[j+1]=stemp[j];
			 stemp[j]=c;

		   }

	   }

   for(i=0;i<strlen(stemp);i++)
   {
	   count=1;
	   if(itemp[i]==1)
		   continue;
        for(j=i+1;j<strlen(stemp);j++)
		{
             if(itemp[j]==1)
				 continue;

			 if(stemp[j]==stemp[i])
			 {
				 itemp[j]=1;
				 count++;
			 }

     		}

      printf("%c=%d\n",stemp[i],count);
   }

}


int main(int argc, char* argv[])
{
	int a,n,s,i,j;
	char str[300];
	scanf("%s",str);
	a=0;
	n=(int)strlen(str);
	for(i=97;i<123;i++){
		s=0;

		for(j=0;j<n;j++){
			if(str[j]==i){
				a=1;
				s++;
			}
		}
		if(s!=0){
			printf("%c=%d\n",(char)i,s);
		}

	}
	if(a==0){
			printf("No\n");

	}
	return 0;
}


int main()
{
	char arrey[300];
	int k=0,i=0,num=0,j=0,n=0;
	scanf("%s",arrey);
	n=strlen(arrey);
	for(i=0;i<n;i++)
	{
		if(arrey[i]<'A'||(arrey[i]>'Z'&&arrey[i]<'a')||arrey[i]>'z')
			num++;
		if(num==n)
			printf("No\n");
	}
	num=0;
	for(j=65;j<91;j++)
	{
		for(k=0;k<n;k++)
		{
			if(arrey[k]==j)
			num++;
		}
		if(num!=0)
		printf("%c=%d\n",j,num);
		num=0;
	}
	for(j=97;j<123;j++)
	{
		for(k=0;k<n;k++)
		{
			if(arrey[k]==j)
			num++;
		}
		if(num!=0)
		printf("%c=%d\n",j,num);
		num=0;
	}
	return 0;
}


int main()
{
	char str[301],s[60]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",*ps,*pt;
	int count=0,t;
	scanf("%s",str);
	for(ps=s;*ps!='\0';ps++)
	{
		t=0;
		for(pt=str;*pt!='\0';pt++)
		{
			if(*pt==*ps)
			{
				t++;
			    count++;
			}
		}
		if(t>0)
			printf("%c=%d\n",*ps,t);
	}
	if(count==0)
		printf("No");

	return 0;
}


int main()
{

	int num[26]={0};
	char zfc[LEN];
	int len,i,flag;
	scanf("%s",zfc);
     len=strlen(zfc);
	for(i=0;i<len;i++){
		if(zfc[i]>='a'&&zfc[i]<='z'){
			num[zfc[i]-'a']++;
		}
	}
    flag=1;
	for(i=0;i<26;i++){
		if(num[i]!=0){
			printf("%c=%d\n",'a'+i,num[i]);
			flag=0;
		}
	}
	if(flag){
		printf("No");
	}

	return 0;

}


int main(int argc, char* argv[])
{
	int n,i,no=0;
	char zm[300],ch;
	scanf("%s",zm);
	n=strlen(zm);
    for(ch='A';ch<='Z';ch++){	int k=0;
		for(i=0;i<n;i++){

			if(zm[i]==ch){

			k++;
			}
		}
		if(k!=0){
		printf("%c=%d\n",ch,k);
		}
	}
	for(ch='a';ch<='z';ch++){	int k=0;
		for(i=0;i<n;i++){

			if(zm[i]==ch){

			k++;
			}
		}
		if(k!=0){
		printf("%c=%d\n",ch,k);
		no=1;
		}
	}
	if(no==0){printf("No");}
	return 0;
}


int main()
{
	int i,k,a,j,c=0,have[26];
	char fh[300],xin[26],haha;
	gets(fh);
	k=strlen(fh);
	for(i=0;i<k;i++)
	{
		if(fh[i]>='a'&&fh[i]<='z')
		{
			xin[c]=fh[i];
            c+=1;
		    a=1;
		    for(j=i+1;j<k;j++)
			{
			    if(fh[i]==fh[j])
				{
					a+=1;
					fh[j]='0';
				}
			}
			have[c-1]=a;

		}
	}
	if(c==0)
		printf("No\n");
	else
	{
        for(i=0;i<c;i++)
		{
			for(j=i+1;j<c;j++)
			{
				if(xin[j]<xin[i])
				{
					haha=xin[i];
					xin[i]=xin[j];
					xin[j]=haha;
					k=have[i];
					have[i]=have[j];
					have[j]=k;
				}
			}
			printf("%c=%d\n",xin[i],have[i]);
		}
	}

	return 0;

}


int main(int argc, char* argv[])
{
    char str[500];
	int k,i;
	char chr;
	int num,you=0;

	gets(str);

	for(k=97;k<123;k++){
		chr=k;
		num=0;

		for(i=0;i<strlen(str);i++){
			if(str[i]==k){num++;you=1;}
		}
			if(num!=0){printf("%c=%d\n",chr,num);}

    }
	if(you==0){printf("No");}
	return 0;
}


int main()
{
 char zu[53]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 char su[300];
 int k,i,x[52]={0},y=0;
 scanf("%s",su);
 for(i=0;i<52;i++)
 {
 for(k=0;k<strlen(su);k++)
 if(su[k]==zu[i])
 x[i]++;
 if(x[i]!=0)
{ printf("%c=%d\n",zu[i],x[i]);y++;}
}if(y==0)
printf("No");
    return 0;}


int main()
{
	char str[100];
	char mod[100]={"abcdefghijklmnopqrstuvwxyz"};
	int i,l,n,t,j;
	gets(str);
	l=strlen(str);
	for(i=0;i<26;i++)
	{
		n=0;
		t=100;
		for(j=l-1;j>=0;j--)
		{
		    if(str[j]==mod[i])
			{
				t=i;
				n++;
			}
		}
		if(t!=100)
		printf("%c=%d\n",mod[t],n);
	}
	t=0;
	for(j=0;j<l;j++)
	{

		if(str[j]>'a'&&str[j]<'z')
			t++;
	}
	if(t==0)
	printf("No");
	return 0;
}


int main(){
    char xulie[LEN],daxiezimu[LEN1],xiaoxiezimu[LEN1],*ps;
    int daxiecishu[LEN2],xiaoxiecishu[LEN2];
    int a=0,b,c=0,d,e,f,i;
    scanf("%s",xulie);
    for(b=0;b<LEN2;b++){
      daxiecishu[b]=0;
      xiaoxiecishu[b]=0;
    }
    for(i=0;i<strlen(xulie);i++){
      if(xulie[i]>='A'&&xulie[i]<='Z'){
        daxiezimu[xulie[i]-'A']=xulie[i];
        daxiecishu[xulie[i]-'A']++;
        c++;
      }
      if(xulie[i]>='a'&&xulie[i]<='z'){
        xiaoxiezimu[xulie[i]-'a']=xulie[i];
        xiaoxiecishu[xulie[i]-'a']++;
        a++;
      }
    }
    if(a+c!=0){
    for(e=0;e<LEN1-1;e++){
      if(daxiecishu[e]!=0){
        printf("%c=%d\n",daxiezimu[e],daxiecishu[e]);
      }
    }

     for(f=0;f<LEN1-1;f++){
      if(xiaoxiecishu[f]!=0){
        printf("%c=%d\n",xiaoxiezimu[f],xiaoxiecishu[f]);
      }
    }
    }
    if(a+c==0){
      printf("No");
    }
    return 0;
}


int main (int argc, char *argv[])
{
    int  all, i;
    char str[300],t[300];
    gets(str);
    all=0;
    memset(t, 0, sizeof(t));
    for (i = 0; str[i] != '\0'; i++){
        if (str[i] >= 'a' && str[i] <= 'z') {
                   t[str[i]]++;
                   all++;
        }
    }
    if (all == 0)
       printf("No\n");
    else {
         for (i = 'a'; i <= 'z'; i++){
             if (t[i] > 0){
                printf("%c=%d\n", (char)i, t[i]);
             }
         }
    }
  return 0;
}


int charnum(char c, char m[]);
int main()
{
	char zifu[301];
	scanf ("%s",zifu);
	int j;
	int sum,no=0;
 	for (j=97;j<123;j++)
	{
	    sum=charnum((char)j,zifu);
		if (sum!=0)
		{
			printf ("%c=%d\n",j,sum);
			no++;
		}
	}

	if(no==0)
	{
		printf ("No");
	}
	return 0;
}

int charnum(char c, char m[])
{
	int len = strlen(m) ;
	int i,sum=0;
		for(i=0;i<len;i++)
		{
			if (m[i]==c)
			{
				sum ++ ;
			}
		}
	return sum;
}


int main(){
	char zfc[300];
	int geshu[52];
	char zimu[52];
	int i,j;
	int s=0;
	int n;
	for(i=0;i<26;i++){
		geshu[i]=0;
		zimu[i]=65+i;
	}
	for(i=26;i<52;i++){
		geshu[i]=0;
		zimu[i]=71+i;
	}
	scanf("%s",zfc);
	n=strlen(zfc);
	for(j=0;j<n;j++){
		for(i=0;i<52;i++){
			if(zfc[j]==zimu[i]){
				geshu[i]+=1;
			}
		}
	}
	for(i=0;i<52;i++){
		if(geshu[i]!=0){
			s+=geshu[i];
		  printf("%c=%d\n",zimu[i],geshu[i]);
		}
	}
	if(s==0){
			printf("No");
	}
	return 0;
}


int main(int argc, char* argv[])
{
char str[300],*ps,i;
int count=0;
scanf("%s",str);
for(i=0;str[i]!='\0';i++){
if(str[i]>='a'&&str[i]<='z')
count++;
}
if(count==0)
printf("No");
else{
for(i=97;i<=122;i++){
count=0;
for(ps=str;*ps!='\0';ps++){
if(*ps==i){
count++;
}
}
if(count!=0)
printf("%c=%d\n",i,count);
}
}
return 0;
}


void main()
{
	int num(int i,char letter[100]);
	char letter[100];
	scanf("%s",letter);
	int count=strlen(letter);
	int i,j=0,k=0;
	int a[30];
	for(i=0;i<26;i++) a[i]=num(i,letter);
	for(i=0;i<26;i++){ if(a[i]>0) j++;}
	if(j==0) printf("No");
	else if(j>0)
		for(i=0;i<26;i++)
		{
			if((a[i]>0)&&(k<j)){printf("%c=%d\n",i+97,a[i]);k++;}
            else if((a[i]>0)&&(k==j)) printf("%c=%d",i+97,a[i]);
		}
}
int num(int i,char letter[100])
{
	int j;
	int l=0;
	for(j=0;;j++)
	{
		if(letter[j]==i+97) l++;
		if(letter[j]=='\0') break;
	}
    return(l);
}


int main(){
	char zfc[300];
    scanf("%s",zfc);
    int count;
    count= strlen(zfc);
    int i=0,sum=0;
    for(int k = 97;k<123;k++){
		for (i=0;i<count;i++){
			if(zfc[i] == k){
			sum++;
			}
		}
		if(sum!=0){
			printf("%c=%d\n",k,sum);
			sum=0;
		}
	}
	for (i=0;i<count;i++){
		if(zfc[i]>96 && zfc[i]<123){
		sum=1;
		}
	}
	if(sum!=1){
		printf("No");
	}
	return 0;
}


	char a[302];
	int flag[302],upper[27]={0},lower[27]={0};
	int len,t=0;
void get()
{
	int i;
	gets(a);
	len=strlen(a);
	for(i=0;i<27;i++)
	{
		upper[i]=0;
		lower[i]=0;
	}
}
void arrange()
{
	int i,j=0;
	for(i=0;i<len;i++)
	{
		if(isupper(a[i]))
		{	flag[i]=1;a[i]=a[i]-'A'+1;}
		else if(islower(a[i]))
		{   flag[i]=-1;a[i]=a[i]-'a'+1;}
		else j++;
	}
		if(j==i)
			t=1;
	for (i=0;i<len;i++)
	{
		if(flag[i]==1)
		{
			upper[a[i]]=upper[a[i]]+1;
		}
		else if(flag[i]==-1)
		{
			lower[a[i]]=lower[a[i]]+1;
		}

	}

}

void put()
{
	int i,j=0;
	for(i=1;i<=26;i++)
	{
		if(upper[i])
			printf("%c=%d\n",i+'A'-1,upper[i]);
	}
	for(i=1;i<=26;i++)
		if(lower[i])
			printf("%c=%d\n",i-1+'a',lower[i]);
	if(t)
		printf("No");
}
void main()
{
	get();
	arrange();
	put();
}


int main(){
	char input[300];
	int i;
	scanf("%s",input);
	int cishu[26];
	for(i=0;i<26;i++)
	{
		cishu[i]=0;
	}
	int LEN;
	LEN=strlen(input);
	for(i=0;i<LEN;i++)
	{
		if(input[i]>=97&&input[i]<=122){

			cishu[input[i]-97]+=1;
		}
	}
int result=0;
	for(i=0;i<26;i++)
	{
		if(cishu[i]==0)
		{
			result+=0;
		}
        if(cishu[i]!=0)
		{
			result+=1;
		}
	}
if (result!=0)
{
		for(i=0;i<26;i++)
	{
		if(cishu[i]!=0)
		{
		printf("%c=%d\n",i+97,cishu[i]);
		}
	}
}
else{
	printf("No\n");
}

return 0;
}


void main()
{
	void num(char a[1000]);
	char b[1000];
	gets(b);
	num(b);
}
void num(char a[])
{
	char let;
	int d,i,c;
	for(let='a',c=0;let<='z';let++)
	{
		d=0;
		for(i=0;i<strlen(a);i++)
			if(a[i]==let)
				d++;
		if(d!=0)
		{
			printf("%c=%d\n",let,d);
			c++;
		}
	}
	if(c==0)
		printf("No");
}


int main()
{
char ch,CH, str[301];
int i, len, no=1,NO=1, counter[26]={0},count[26]={0};
scanf("%s", str);
len = strlen(str);
for (i=0; i<len; i++) {
CH=ch = str[i];
if (ch >= 'a' && ch <= 'z') {
counter[ch-'a']++;
no = 0;
}
if (CH >= 'A' && CH <= 'Z'){
	count[CH-'A']++;
	NO++;
}
}
for (CH='A';CH<='Z';CH++){
if (count[CH-'A']>0){
	printf("%c=%d\n",CH,count[CH-'A']);
}
}
for (ch='a'; ch<='z'; ch++) {
if (counter[ch-'a'] > 0) {
printf("%c=%d\n", ch, counter[ch-'a']);
}
}
if (no && NO) {
printf("No");
}
return 0;
}


int f(char s[],char c){
	unsigned int i,count=0;
	for(i=0;i<strlen(s);i++){
		if(s[i]==c){
			count++;
		}
	}
	if(count){
		printf("%c=%d\n",c,count);

	}
	return 0;
}

main()
{
	char s[300],b;
	int i,len,count=0;
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<len;i++){
		if(s[i]<='z'&&s[i]>='a'){
			count++;break;
		}
	}
	if(count==0){
		printf("No\n");
	}else{
		for(b='a';b<='z';b++){
			f(s,b);
		}
	}
}


int main()
{
int m,i,sz[300],tag=0;
char zf[303];
char bz[54]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
gets(zf);
 for(i=0;i<52;i++)
     {
        sz[i]=0;
		m=0;
			while(zf[m]!='\0')
            {
            if(zf[m]==bz[i])
			{
                   sz[i]++;
                   tag=1;
			}
			m++;
			}

		if(sz[i]!=0)
		{
			printf("%c=%d\n",bz[i],sz[i]);
		}
      }
if(tag==0)
{
printf("No");
}
return 0;
}


void main()
{
	char string[N];
	int f[26]={0},i,j,s,count=1,d=0;
	s=strlen(string);
	gets(string);
	s=strlen(string);
	for(i=0;i<s;i++)
		if(string[i]<='z' && string[i]>='a')
		{
			d++;
			f[string[i]-'a']=1;
			for(j=i+1;j<s;j++)
				if(string[j]==string[i])
				{
					f[string[i]-'a']++;
					string[j]=0;
				}
		}
	if(d==0)
		printf("No\n");
	for(i=0;i<26;i++)
		if(f[i])
			printf("%c=%d\n",i+'a',f[i]);
}


int main(){
char str[301],zimu[27]="abcdefghijklmnopqrstuvwxyz";
int i,k,len,num[27],sum=0;
scanf("%s",&str);
len=strlen(str);
for(i=0;i<27;i++)
{
	num[i]=0;
	for(k=0;k<len;k++)
	{
		if(zimu[i]==str[k])
		{
			num[i]++;
		}

	}

}
for(i=0;i<27;i++)
{
         sum+=num[i];
	if(num[i]>0)
	{
	printf("%c=%d\n",zimu[i],num[i]);
	}
}
if(sum==0)
{
printf("No");
}

return 0;
}


int main(){
    char zfc[300];
    char zm[27]="abcdefghijklmnopqrstuvwxyz";
    int sz[26];
    int i,j,len;
    int result=0;
    scanf("%s",zfc);
    len=strlen(zfc);
    for(i=0;i<26;i++){
        sz[i]=0;
        for(j=0;j<len;j++){
            if(zfc[j]==zm[i]){
               sz[i]++;
            }
        }
    }
    for(i=0;i<26;i++){
        if(sz[i]!=0){
           printf("%c=%d\n",zm[i],sz[i]);
        }
    }
    for(i=0;i<26;i++){
        result+=sz[i];
    }
    if(result==0){
       printf("No");
    }
    return 0;
}


int main()
{
	char s1[300];
	char s2[28]="abcdefghijklmnopqrstuvwxyz",*ps;
	int count,i,k=0;
    scanf("%s",s1);
	int len = strlen(s1);
	for(ps=s2;*ps!='\0';ps++)
	{
		count=0;
        for(i=0;i<len;i++)
		{
			if(s1[i]==*ps)
				count++;
		}
		if(count!=0)
		{
		    k++;
			printf("%c=%d\n",*ps,count);
	    }

	}
	if(k==0)
	{
		printf("No");
	}
	return 0;
}


int main()
{
	char str[100];
	char str1[53]={"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"};
	int a[52]={0};
	gets(str);
	int m=0,i,j,k=0;
	m=strlen(str);
	for(i=0;i<m;i++)
	{
		for(j=65;j<91;j++)
		{
			if(str[i]==j)
			{a[j-65]++;
			k++;}
		}
	}
	for(i=0;i<m;i++)
	{
		for(j=97;j<123;j++)
		{
			if(str[i]==j)
			{a[j-71]++;
			k++;}
		}
	}
	for(i=0;i<52;i++)
	{
		if(a[i]!=0)
		{
			printf("%c=%d\n",str1[i],a[i]);
		}
	}

	   if(k==0)
		printf("No");
		return 0;
}


void statistic(char str[],int letter_num[],int n)
{
	int i;
	for(i=0;i<n;i++)
		letter_num[str[i]-'a']++;
}

void main()
{
	char str[300],letter[27]={"abcdefghijklmnopqrstuvwxyz"};
	int n,i,letter_num[26]={0},t=0;
	gets(str);
	n=strlen(str);
	statistic(str,letter_num,n);
	for(i=0;i<26;i++)
	{
		if(letter_num[i]!=0)
		{
			putchar(letter[i]);
			printf("=%d\n",letter_num[i]);
			t++;
		}
	}
	if(t==0)
		printf("No");
}


struct string
{
	char cha;
	int num;
};
int main()
{
	char str[310];
	struct string s[52],temp;
	int i,n,j,l,k=0;

    scanf("%s",str);

	l=strlen(str);
	for(i=0;i<l;i++)
	{
		n=1;
		if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
		{

			for(j=i+1;j<l;j++)
			{
				if(str[j]==str[i])
				{
					n++;
					str[j]='.';
				}
				else continue;
			}

			s[k].cha=str[i];
			s[k].num=n;
			k++;
		}

	}

	for(i=0;i<k-1;i++)
	{
		n=i;
		for(j=i+1;j<k;j++)
			if(s[j].cha<s[n].cha)
				n=j;
		temp=s[i];
		s[i]=s[n];
		s[n]=temp;
	}
	for(i=0;i<k;i++)
		printf("%c=%d\n",s[i].cha,s[i].num);

	if(k==0)
	{
		printf("No\n");
		return 0;
	}

	return 0;
}


int main(){
	char str[N],j;
	gets(str);
	int len,i,x=1;
	len=strlen(str);
	for(j='A';j<='Z';j++){
        int sum=0;
    for(i=0;i<len;i++){
		if(str[i]==j){
			sum++;
			x=0;
		}
	}
		if(sum!=0){
			printf("%c=%d\n",j,sum);
	}
	}
	for(j='a';j<='z';j++){
        int sum=0;
    for(i=0;i<len;i++){
		if(str[i]==j){
			sum++;
			x=0;
		}
	}
		if(sum!=0){
			printf("%c=%d\n",j,sum);
		}
	}
	 if(x){
		 printf("No");
	 }
	 return 0;
}


int main()
{
    char ch, str[301];
    int i, len, no=1, counter[80]={0};

    scanf("%s", str);

    len = strlen(str);

   for (i=0; i<len; i++) {
        ch = str[i];
        if (ch >= 'A' && ch <= 'Z') {
            counter[ch-'A']++;
            no = 0;
        }
    }

    for (ch='A'; ch<='Z'; ch++) {
        if (counter[ch-'A'] > 0) {
            printf("%c=%d\n", ch,counter[ch-'A']);
        }
    }
for(i=0;i<79;i++){counter[i]=0;}
for (i=0; i<len; i++) {
        ch = str[i];

        if (ch >= 'a' && ch <= 'z') {
            counter[ch-'a']++;
            no = 0;
        }
    }

    for (ch='a'; ch<='z'; ch++) {
        if (counter[ch-'a'] > 0) {
            printf("%c=%d\n", ch, counter[ch-'a']);
        }
    }

    if (no) {
        printf("No");
    }
    return 0;
}


int main()
{
	char zfc[300]="!";
	int sz[26];
	for (int zm=0;zm<26;zm++){
		sz[zm]=0;
	}
	scanf("%s",zfc);
	int sum=0;
	for(int dng=0;dng<300;dng++){
		switch(zfc[dng])
		{
		case'a':sz[0]+=1,sum++;break;
		case'b':sz[1]+=1,sum++;break;
		case'c':sz[2]+=1,sum++;break;
		case'd':sz[3]+=1,sum++;break;
		case'e':sz[4]+=1,sum++;break;
		case'f':sz[5]+=1,sum++;break;
		case'g':sz[6]+=1,sum++;break;
		case'h':sz[7]+=1,sum++;break;
		case'i':sz[8]+=1,sum++;break;
		case'j':sz[9]+=1,sum++;break;
		case'k':sz[10]+=1,sum++;break;
		case'l':sz[11]+=1,sum++;break;
		case'm':sz[12]+=1,sum++;break;
		case'n':sz[13]+=1,sum++;break;
		case'o':sz[14]+=1,sum++;break;
		case'p':sz[15]+=1,sum++;break;
		case'q':sz[16]+=1,sum++;break;
		case'r':sz[17]+=1,sum++;break;
		case's':sz[18]+=1,sum++;break;
		case't':sz[19]+=1,sum++;break;
		case'u':sz[20]+=1,sum++;break;
		case'v':sz[21]+=1,sum++;break;
		case'w':sz[22]+=1,sum++;break;
		case'x':sz[23]+=1,sum++;break;
		case'y':sz[24]+=1,sum++;break;
		case'z':sz[25]+=1,sum++;break;
		}
	}
	if(sum==0){
		printf("No");
	}
	else{
		for(int djg=0;djg<26;djg++){
			if(sz[djg]!=0){
				char xxzm=97+djg;
				printf("%c=%d\n",xxzm,sz[djg]);
			}
		}
	}
	return 0;
}


int main()
{
	int ass,bss,css;
	for(int a=1;a<4;a++){
		for(int b=1;b<4;b++){
			for(int c=1;c<4;c++){
				int as=(b>a)+(c==a);
				int bs=(a>b)+(a>c);
				int cs=(c>b)+(b>a);
				if(!(a<=b&&as<=bs||a<=c&&as<=cs||b<=c&&bs<=cs||b<=a&&bs<=as||c<=a&&cs<=as||c<=b&&cs<=bs)){
					ass=a,bss=b,css=c;
				}
			}
		}
	}
	if(ass>=bss&&bss>=css)cout<<"CBA"<<endl;
	if(ass>=css&&css>=bss)cout<<"BCA"<<endl;
	if(bss>=ass&&ass>=css)cout<<"CAB"<<endl;
	if(bss>=css&&css>=ass)cout<<"ACB"<<endl;
	if(css>=ass&&ass>=bss)cout<<"BAC"<<endl;
	if(css>=bss&&bss>=ass)cout<<"ABC"<<endl;
	return 0;
}


int main()
{
     int A,B,C,i;
     int ans,bns,cns;
	 int Ans,Bns,Cns;
     for(A=1;A<4;A++)
        {
           for(B=1;B<4;B++)
             {if(B==A)
                 continue;
              C=6-B-A;
               ans=(B>A)+(C==A);
			  bns=(A>B)+(A>C);
			  cns=(C>B)+(B>A);
			  if((B+bns==3)&&(A+ans==3)&&(C+cns==3))
			  {Ans=A;
			  Bns=B;
			  Cns=C;
			  }
		   }
		   }

		  for(i=1;i<4;i++)
		  {
			  if(i==Ans)
				  cout<<"A";
			  else if(i==Bns)
				  cout<<"B";
			  else
				  cout<<"C";
		  }
		  return 0;
	 }


void search();
int f[3];
int main()
{

   int i,j,k;
   for(i=1;i<4;i++)
   {
      f[0]=i;
      for(j=1;j<4;j++)
      {
          if(i==j)continue;
          f[1]=j;
          for(k=1;k<4;k++)
          {
              if(k==j)continue;
              if(k==i)continue;
              f[2]=k;
              search();
          }
      }
   }
    return 0;
}

void search()
{
    int count0=0,count1=0,count2=0,i,j;
    char a;
    if(f[1]>f[0])count0++;
    if(count0!=3-f[0])return;
    if(f[0]>f[1])count1++;
    if(f[0]>f[2])count1++;
    if(count1!=3-f[1])return;
    if(f[2]>f[1])count2++;
    if(f[1]>f[0])count2++;
    if(count2!=3-f[2])return;
    for(i=1;i<4;i++)
    {
        for(j=0;j<3;j++)
        {
            if(f[j]==i)
            {
                a=j+'A';
                cout<<a;
            }
        }
    }
    return;
}


/*
 * file    homework 8_4
 * author  ??
 * date    2010-11-18
 * description
           ???????
*/

int main()
{
	int a, b, c, t;
	int aa, bb, cc;
	for (a = 0; a <= 2; a ++)
	{
		for (b = 0; b <= 2; b ++)
        {
			for (c = 0; c <= 2; c ++)
			{
				t = 0;
				aa = (b > a) + (c == a);
				bb = (a > b) + (a > c);
				cc = (c > b) + (b > a);
				t = (a + aa == 2) + (b + bb == 2) + (c + cc == 2);
			    if (t == 3) break;
			}
			if (t == 3) break;
		}
		if (t == 3) break;
	}
	if (a > b)
		if(b > c)
			cout << "CBA" <<endl;
		else
			if (a > c)
				cout << "BCA" <<endl;
			else
				cout << "BAC" << endl;
	else
		if (a > c)
			cout << "CAB" << endl;
		else
			if(b > c)
				cout << "ACB" << endl;
			else
				cout << "ABC" << endl;

	return 0;
}


int main()
{
	int A,B,C;
	int c1,c2,c3;
	for(A=1;A<=3;A=A+1)
		for(B=1;B<=3;B=B+1)
			for(C=1;C<=3;C=C+1)
			{
				c1=(B>A)+(C+A);
				c2=(A>B)+(A>C);
				c3=(C>B)+(B>A);
				if(A+c1==B+c2==C+c3==3)
					break;
			}
	if(A>B)
	{
		if(B>C) cout <<"ABC" <<endl;
		else if(C>A) cout <<"CAB" <<endl;
		else cout <<"ACB" <<endl;
	}
	else
	{
		if(A>C) cout <<"BAC" <<endl;
		else if(C>B) cout <<"CBA" <<endl;
		else cout <<"BCA" <<endl;
	}
	return 0;
}


/**
* @file homework.cpp
* @author ???
* @date 2011-10-12
* @description
* ??????: ???
*/
int main()
{
	int riceA, riceB, riceC, wordA, wordB, wordC;
	for (riceA=0;riceA<=2;riceA++)
		for (riceB=0;riceB<=2;riceB++)
			{if (riceB==riceA) continue;
			for (riceC=0;riceC<=2;riceC++)
				{if (riceC==riceA||riceC==riceB) continue;
					wordA=(riceB>riceA)+(riceC==riceA);
					wordB=(riceA>riceB)+(riceA>riceC);
					wordC=(riceC>riceB)+(riceB>riceA);
					if ((wordA+riceA==2)&&(wordB+riceB==2)&&(wordA+riceA==2))
						{
						if ((riceA<riceB)&&(riceA<riceC)&&(riceB<riceC)) cout<<"ABC";
						if ((riceA<riceB)&&(riceA<riceC)&&(riceB>riceC)) cout<<"ACB";
						if ((riceB<riceA)&&(riceB<riceC)&&(riceA<riceC)) cout<<"BAC";
						if ((riceB<riceA)&&(riceB<riceC)&&(riceA>riceC)) cout<<"BCA";
						if ((riceC<riceA)&&(riceC<riceB)&&(riceA<riceB)) cout<<"CAB";
						if ((riceC<riceA)&&(riceC<riceB)&&(riceA>riceB)) cout<<"CBA";
						}
				}
			}
return 0;
}


int main()
{
	int A,B,C,i=0;
	int state[3];
	char name[3];
	for(A=0;A<3;A++)
	{
		for(B=0;B<3;B++)
		{
			if(A==B) continue;
			C=3-A-B;
			state[A]=(B>A)+(C==A);
			state[B]=(A>B)+(A>C);
			state[C]=(C>B)+(B>A);
			if(state[A]+A==2&&state[B]+B==2&&state[C]+C==2)
			{
				name[A]='A';
				name[B]='B';
				name[C]='C';
				for(i=0;i<3;i++)
					cout<<name[i];
			}
		}
	}
	cout<<endl;
	return 0;
}


int main()
{
	int a,b,c;
	char s[3];
	int i,j,k,m;
	cout<<"BCA"<<endl;
	return 0;
}


int main()
{
	int a,b,c;
	for(a=0;a<=2;a++)
		for(b=0;b<=2;b++)
		{
			if(a==b)continue;
			else
			{
				c=3-a-b;
				if(((a+(b>a)+(c==a))==2)&&((b+(a>b)+(a>c))==2)&&((c+(c>b)+(b>a))==2))
				{
					if(a<b&&b<c)cout<<"ABC";
					else if(a<c&&c<b)cout<<"ACB";
					else if(b<a&&a<c)cout<<"BAC";
					else if(b<c&&c<a)cout<<"BCA";
					else if(c<a&&a<b)cout<<"CAB";
					else cout<<"CBA";
					break;
				}
			}
		}
	return 0;
}


//
//  main.cpp
//  poj
//
//  Created by ChuPan,Wong on 9/27/13.
//  Copyright (c) 2013 ChuPan,Wong. All rights reserved.
//

int main(int argc, const char * argv[])
{
    int A,B,C;
    int a,b,c;
    for(int i=1;i<4;i++){
        for(int j=1;j<4;j++){
            for(int k=1;k<4;k++){
                A = i; B = j; C = k;
                a = (int)(B>A) + (int)(A==C);
                b = (int)(A>B) + (int)(A>C);
                c = (int)(C>B) + (int)(B>A);
                if(!((A>=B&&a>b)||(A>=C&&a>c)||(B>=A&&b>a)||(B>=C&&b>c)
                   ||(C>=A&&c>a)||(C>=B&&c>b))){
                    if(A>=B&&B>=C)
                        cout<<"ABC"<<endl;
                    else if(A>=C&&C>=B)
                        cout<<"ACB"<<endl;
                    else if(B>=A&&A>=C)
                        cout<<"BAC"<<endl;
                    else if(B>=C&&C>=A)
                        cout<<"BCA"<<endl;
                    else if(C>=A&&A>=B)
                        cout<<"CAB"<<endl;
                    else
                        cout<<"CBA"<<endl;
                    return 0;
                }

            }
        }
    }

}


int main()
{
	int A,B,C;
	for(int a = 1;a <= 3;a ++)
		for(int b = 1;b <= 3;b ++)
			for(int c = 1;c <= 3;c ++){
				A = (a < b) + (a == c);
				B = (a > b) + (a > c);
				C = (c > b) + (b > a);
				if(a < b && b < c && A > B && B > C) printf("ABC\n");
				if(a < c && c < b && A > C && C > B) printf("ACB\n");
				if(b < a && a < c && B > A && A > C) printf("BAC\n");
				if(b < c && c < a && B > C && C > A) printf("BCA\n");
				if(c < a && a < b && C > A && A > B) printf("CAB\n");
				if(c < b && b < a && C > B && B > A) printf("CBA\n");
			}
	return 0;
}


int f(int a,int b)
{   int c;
    if(a>=b)
    c=1;
    else
    c=0;
    return c;
}
int main()
{
    int a,b,c,A,B,C,sum,g=0,s=0;
    for(A=1;A<4;A++)
    {
       for(B=1;B<4;B++)
       {
          for(C=1;C<4;C++)
          {
             a = (B > A) + (C == A);
             b = (A > B) + (A > C);
             c = (C > B) + (B > A);
             sum = (f(A,B)+f(a,b)==1)+(f(B,C)+f(b,c)==1)+(f(C,A)+f(c,a)==1);
             if(sum == 3)
             {
             if(A>=B)
             {
               if(B>=C)
               cout << "ABC";
               else if(A>=C)
               cout << "ACB";
               else
               cout << "CAB";
             }
             else
             {
               if(A>=C)
               cout << "BCA";
               else if(B>=C)
               cout << "BAC";
               else
               cout << "CBA";
               }
             g=1;
             break;
             }
          }
       if(g==1)
       {
         s=1;
         break;
       }
       }
       if(s==1)
       break;
    }
    return 0;
}


int check_assertions_a(int i, int j, int k)
{
    int correct = 0;
    if (j < i) {
        correct += 1;
    }
    if (k == i) {
        correct += 1;
    }
    return correct;
}

int check_assertions_b(int i, int j, int k)
{
    int correct = 0;
    if (i < j) {
        correct += 1;
    }
    if (i < k) {
        correct += 1;
    }
    return correct;
}

int check_assertions_c(int i, int j, int k)
{
    int correct = 0;
    if (k < j) {
        correct += 1;
    }
    if (j < i) {
        correct += 1;
    }
    return correct;
}

int main()
{
    int i, j, k;
    int array[3] = {1, 2, 3};
    for (i = 0; i < 3; i++) {
        for (j = 0; j < 3; j++) {
            for (k = 0; k < 3; k++) {
                if (i == j || i == k || j == k) {
                    continue;
                }
                if (check_assertions_a(i, j, k) == i &&
                    check_assertions_b(i, j, k) == j &&
                    check_assertions_c(i, j, k) == k) {
                    printf("%c%c%c", k+'A', j+'A', i+'A');
                }
            }
        }
    }
    return 0;
}


int main()
{
	int a,b,c;
	int Aa,Bb,Cc;
	for(a=1;a<4;a++)
		for(b=1;b<4;b++)
			for(c=1;c<4;c++)
			{
				Aa=(b>a)+(c==a);
							            Bb=(a>b)+(a>c);
							            Cc=(c>b)+(b>a);
							            if (a+Aa==3)
							            	            	if(b+Bb==3)
							            	            		if(c+Cc==3)

	            	if(a>b&&b>c)
	            		cout<<"CBA";
	            	else
	            if(a>c&&c>b)
	            	            		cout<<"BCA";
	            else
	            if(b>a&&a>c)
	            	            		cout<<"CAB";
	            else
	            if(b>c&&c>a)
	            	            		cout<<"ACB";
	            else
	            if(c>b&&b>a)
	            	            		cout<<"ABC";
	            else
	            if(c>a&&a>b)
	            	            		cout<<"BAC";
			}

return 0;
}


/*
 * practice.cpp
 *
 *  Created on: 2013-12-26
 *      Author: 111
 */

int main()
{
	int a,b,c,isa,isb,isc;
	for (a=1;a<=3;a++)
		for (b=1;b<=3;b++)
			for (c=1;c<=3;c++)
			{
				isa = (b>a) + (c==a);
				isb = (a>b) + (a>c);
				isc = (c>b) + (b>a);
				if ((a+isa==b+isb)&&(b+isb==c+isc))
				{
				    if(isa<isb&&isb<isc)  cout << "CBA";
				    if(isa<isc&&isc<isb)  cout << "BCA";
				    if(isb<isa&&isa<isc)  cout << "CAB";
				    if(isb<isc&&isc<isa)  cout << "ACB";
				    if(isc<isa&&isa<isb)  cout << "BAC";
				    if(isc<isb&&isb<isa)  cout << "ABC";
				}
			}
	return 0;
}


void bijiao(int, int, int);
int main()
{
	int a, b, c;
	for (a = 1; a <= 3; a++)
		for (b = 1; b <= 3; b++)
			for (c = 1; c <= 3; c++)
			{
				bijiao (a, b, c);
			}
			return 0;
}
void bijiao(int a,int b,int c)
{
	int ca = (b > a) + (c == a);
	int cb = (a > b) + (a > c);
	int cc = (c > b) + (b > a);
	if(((a > b && ca < cb) || ( a == b && ca == cb) || (a < b && ca > cb))
       + (( a > c && ca < cc) || ( a == c && ca == cc) || ( a < c && ca > c))
       + (( b < c && cb > cc) || (b > c && cb < cc) || ( b == c && cb == cc)) == 3)
	{
		if (a >= b)
		{
			if (c >= b)
			{
				if (a >= c)
					cout << "BCA";
				else cout << "BAC";
			}
			else cout << "CBA";
		}
		else
			if(c <= b)
		{
			if (a <= c)
				cout << "ACb";
			else cout << "CAB";
		}
			else cout << "ABC";
	}
}


int main()
{
	int A,B,C;
	for(A=0;A<3;A++)
	  for(B=0;B<3;B++)
	    for(C=0;C<3;C++)
	    {
	     int a=(A<B)+(A==C);
	     int b=(A>B)+(A>C);
	     int c=(C>B)+(B>A);
	     if(a>b&&b>c    &&    A<B&&B<C)
	        cout<<"ABC"<<endl;
	     if(a>c&&c>b    &&    A<C&&C<B)
	        cout<<"ACB"<<endl;
	     if(b>a&&a>c    &&    B<A&&A<C)
	        cout<<"BAC"<<endl;
	     if(b>c&&c>a    &&    B<C&&C<A)
	        cout<<"BCA"<<endl;
	     if(c>a&&a>b    &&    C<A&&A<B)
	        cout<<"CAB"<<endl;
	     if(c>b&&b>a    &&    C<B&&B<A)
	        cout<<"CBA"<<endl;
	    }
	return 0;
}


int main()
{
	int A=3,B=2,C=1,sumA,sumB,sumC;//?ABC???????????????
		sumA=(B>A)+(C==A);
		sumB=(A>B)+(A>C);
		sumC=(C>B)+(B>A);
		if(sumA<sumB&&sumB<sumC)
			cout<<"CAB"<<endl;
		else
		{

			A=3;B=1;C=2;
			sumA=(B>A)+(C==A);
			sumB=(A>B)+(A>C);
			sumC=(C>B)+(B>A);
			if(sumA<sumC&&sumC<sumB)
				cout<<"BCA"<<endl;
			else
			{
				A=1;B=3;C=2;
				sumA=(B>A)+(C==A);
				sumB=(A>B)+(A>C);
				sumC=(C>B)+(B>A);
				if(sumB<sumC&&sumC<sumA)
					cout<<"ACB"<<endl;
				else
				{
					B=3;A=2;C=1;
					sumA=(B>A)+(C==A);
					sumB=(A>B)+(A>C);
					sumC=(C>B)+(B>A);
					if(sumB<sumA&&sumA<sumC)
						cout<<"CAB"<<endl;
					else
					{
						A=2;C=3;B=1;
						sumA=(B>A)+(C==A);
						sumB=(A>B)+(A>C);
						sumC=(C>B)+(B>A);
						if(sumC<sumA&&sumA<sumB)
							cout<<"BAC"<<endl;
						else
						{
							C=3;B=2;A=1;
							sumA=(B>A)+(C==A);
							sumB=(A>B)+(A>C);
							sumC=(C>B)+(B>A);
							if(sumC<sumB&&sumB<sumA)
								cout<<"ABC"<<endl;
						}
					}
				}
			}
		}
				return 0;
	}


int main()
{
	int A, B, C, AmountA, AmountB, AmountC, jumpout = 0;
	for (AmountA = 0 ; AmountA <= 2 ; AmountA++)
	{
		for (AmountB = 0 ; AmountB <= 2 ; AmountB++)
		{
			if (AmountB == AmountA) continue;
			for (AmountC = 0 ; AmountC <= 2 ; AmountC++)
			{
				if ((AmountC == AmountB) || (AmountC == AmountA)) continue;
				A = ((AmountB > AmountB) + (AmountA == AmountC));
				B = ((AmountA > AmountB) + (AmountA > AmountC));
				C = ((AmountC > AmountB) + (AmountB > AmountA));
				if ((A == 2 - AmountA) && (B == 2 - AmountB) && (C == 2 - AmountC))
					jumpout = 1; break;
			}if (jumpout == 1) break;
		}if (jumpout == 1) break;
	}
	if (AmountA < AmountB && AmountB < AmountC) cout << "ABC";
	if (AmountB < AmountA && AmountA < AmountC) cout << "BAC";
	if (AmountC < AmountB && AmountB < AmountA) cout << "CBA";
	if (AmountB < AmountC && AmountC < AmountA) cout << "BCA";
	if (AmountA < AmountC && AmountC < AmountB) cout << "ACB";
	if (AmountC < AmountA && AmountA < AmountB) cout << "CAB";
	return 0;
}


int main()
{
	int a,b,c;
	int ra,rb,rc;
	char result[4];
	for(a=0;a<3;a++){
		for(b=0;b<3;b++){
			for(c=0;c<3;c++){
				ra=rb=rc=0;

				ra=(b>a)+(c==a);
				rb=(a>b)+(a>c);
				rc=(c>b)+(b>a);

				if( (a>b&&ra>=rb) || (a>c&&ra>=rc) || (b>a&&rb>=ra) || (b>c&&rb>=rc) || (c>a&&rc>=ra) || (c>b&&rc>=rb) || (a==b&&ra!=rb) || (b==c&&rb!=rc) || (a==c&&ra!=rc) )//?????
					continue;
				if(a!=b&&b!=c&&a!=c){
					result[a]='A';
					result[b]='B';
					result[c]='C';
					result[3]='\0';
					cout<<result<<endl;
				}
				else if(a==b){
					if(c<a)  cout<<"CAB"<<endl;
					else     cout<<"ABC"<<endl;
			    }
				else if(b==c){
					if(a<b)  cout<<"ABC"<<endl;
					else     cout<<"BCA"<<endl;
			    }
				else if(a==c){
					if(b<a)  cout<<"BAC"<<endl;
					else     cout<<"ACB"<<endl;
			    }
			}
		}
	}
	//while(1);
	return 0;
}


int main()
{
	int logicA , logicB , logicC;
	int eatA , eatB , eatC;
	char ABC[3];
	for ( eatA = 1; eatA <=3; eatA++ )
	{
		for ( eatB = 1; eatB <=3; eatB++ )
		{
			for ( eatC = 1; eatC <=3; eatC++ )
			{
				logicA = ( (eatB > eatA) + (eatA == eatC) );
				logicB = ( (eatA > eatB) + (eatA > eatC) );
				logicC = ( (eatC > eatB) + (eatB > eatA) );
				if ( ((eatA > eatB && logicA < logicB)
					|| (eatA < eatB && logicA > logicB) || (eatA == eatB && logicA == logicB))
					+ ((eatA > eatC && logicA < logicC)
					|| (eatA < eatC && logicA > logicC) || (eatA == eatC && logicA == logicC))
					+ ((eatC > eatB && logicC < logicB)
					|| (eatC < eatB && logicC > logicB) || (eatC == eatB && logicC == logicB)) == 3 )
				{
					ABC[eatA] = 'A';
					ABC[eatB] = 'B';
					ABC[eatC] = 'C';
					cout << ABC[1] << ABC[2] << ABC[3];
				}
			}
		}
	}

	return 0;

}


/*
 * 12.10.28.cpp
 *Created on: 2012-10-28
 *Author: ???
 *??:???
 */

int comp(int a, int b) {
	if (a > b)
		return 1;
	if (a == b)
		return 0;
	return -1;
}
int main() {
	int A, B, C, nA, nB, nC;
	char ret;
	for (A = 0; A <= 2; A++) {
		for (B = 0; B <= 2; B++) {
			for (C = 0; C <= 2; C++) {
				nA = (B > A) + (C == A);
				nB = (A > B) + (A > C);
				nC = (C > B) + (B > A);
				ret = true;
				if (comp(nA, nB) != comp(B, A))
					ret = false;
				if (comp(nA, nC) != comp(C, A))
					ret = false;
				if (comp(nC, nB) != comp(B, C))
					ret = false;
				if (ret == true) {
					if (A < B && A < C) {
						cout << 'A';
						if (B < C)
							cout << "BC";
						else
							cout << "CB";
					} else if (B < C) {
						cout << 'B';
						if (A < C)
							cout << "AC";
						else
							cout << "CA";
					} else
						cout << "CBA";
				}

			}
		}
	}
	return 0;
}


int exam( char s[4], char t );

int main()
{
    char order[6][4]={"ABC", "ACB", "BAC", "BCA", "CAB", "CBA"};
    for( int i=0; i<6; i++ )
    {
        int a=0, b=0, c=0;
        if( exam( order[i], 'B') < exam( order[i], 'A') )
           a++;
        if( exam( order[i], 'C')-exam( order[i], 'A') ==1 )
           a++;
        if( exam( order[i], 'C')-exam( order[i], 'A') ==-1 )
           a++;
        if( exam( order[i], 'A') < exam( order[i], 'B') )
           b++;
        if( exam( order[i], 'A') < exam( order[i], 'C') )
           b++;
        if( exam( order[i], 'C') < exam( order[i], 'B') )
           c++;
        if( exam( order[i], 'B') < exam( order[i], 'A') )
           c++;
        int k=0;
        if( exam( order[i], 'A') == a)
            k++;
        if( exam( order[i], 'B') == b)
            k++;
        if( exam( order[i], 'C') == c)
            k++;
        if( k == 3 )
            cout << order[i];

    }
    return 0;
}

int exam( char s[4], char t )
{
    for( int i=0; i<3; i++ )
    {
        if( s[i]== t)
            return i;
    }
}


/*
 * shit.cpp
 *
 *  Created on: 2012-10-15
 *      Author: Administrator
 */

int main()
{
	int a,b,c,d,e,f;
	for(a=1;a<=3;a++)
		for(b=1;b<=3;b++)
			for(c=1;c<=3;c++)
				if(a!=b&&b!=c&&a!=c)
				{
					d=(b>a)+(c==a);
					e=(a>b)+(a>c);
					f=(c>b)+(b>a);
					if((a+d)==(b+e)&&(a+d)==(c+f)&&(b+e)==(c+f))
					{
						if(a>b&&b>c) cout<<"CBA";
						else if(a>c&&c>b) cout<<"BCA";
						else if(b>a&&a>c) cout<<"CAB";
						else if(b>c&&c>a) cout<<"ACB";
						else if(c>b&&b>a) cout<<"ABC";
						else if(c>a&&a>b) cout<<"BAC";
					}
				}
	return 0;
}


int main()
	{
		int x,y,z,a,b,c,i,j;
		for(i=0;i<=2;i++)
		{
			a=i;
			for(j=0;j<=2;j++)
			{
				if(j==i)j++;
				else
				{
					b=j;
					c=3-a-b;
					if(b>a&&c==a)x=0;
					else if(b<=a&&c!=a)x=2;
					else x=1;
					if(a>b&&a>c)y=0;
					else if(a<=b&&a<=c)y=2;
					else y=1;
					if(c>b&&b>a)z=0;
					else if(c<=b&&b<=a)z=2;
					else z=1;
					if(x==a&&y==b&&z==c)
					{
					if(b>c&&a>c){putchar('C');if(b>a)printf("AB");else printf("BA");}
					else if(a>b&&c>b){putchar('B');if(a>c)printf("CA");else printf("AC");}
					else if(a<b&&b<c)printf("ABC");
					else printf("ACB");

					}
				}
			}
		}
return 0;
}


int main()
{
	int A, B, C, ra, rb, rc, m, n, l;
	char p, q, r;
	for ( ra = 0; ra <= 2; ra ++)
		for ( rb = 0; rb <= 2; rb ++)
			for ( rc = 0; rc <= 2; rc ++)
			{
				A =( rb > ra )+( rc == ra);     //??A???
				B =( ra > rb )+( ra > rc);      //??B???
				C =( rc > rb )+( rb == ra);     //??C???
				if ( A + B + C == 3)
				{
					if (( A > B )&&( A > C ))
					{
						if ( B > C)
						{
							cout <<"ABC"<< endl;
						}
						else
						{
							cout <<"ACB"<< endl;
						}
					}
					else if (( B > A )&&( B > C ))
					{
						if ( A > C )
						{
							cout <<"BAC"<< endl;
						}
						else
						{
							cout <<"BCA"<< endl;
						}
					}
					else if (( C > A )&&( C > B ))
					{
						m =C;
						if ( A > B )
						{
							cout <<"CAB"<< endl;
						}
						else
						{
							cout <<"CBA"<< endl;
						}
					}
				}
			}

			return 0;
}


int main()
{
	int A,B,C,rightA,rightB,rightC;
	for(A=0;A<=2;A++)
		{for(B=0;B<=2;B++)
			{for(C=0;C<=2;C++)
	               {if(B>A&&A==C) rightA=2;
				   else if(B>A||A==C) rightA=1;
				   else rightA=0;
				    if(A>B&&A>C) rightB=2;
				   else if(A>B||A>C) rightB=1;
				   else rightB=0;
				    if(C>B&&B>A) rightC=2;
				   else if(C>B||B>A) rightC=1;
				   else rightC=0;

				   if(rightA>rightB&&rightB>rightC&&A<B&&B<C) cout<<"ABC"<<endl;
				   if(rightA>rightC&&rightC>rightB&&A<C&&C<B) cout<<"ACB"<<endl;
				   if(rightB>rightA&&rightA>rightC&&B<A&&A<C) cout<<"BAC"<<endl;
				   if(rightB>rightC&&rightC>rightA&&B<C&&C<A) cout<<"BCA"<<endl;
				   if(rightC>rightA&&rightA>rightB&&C<A&&A<B) cout<<"CAB"<<endl;
				   if(rightC>rightB&&rightB>rightC&&C<B&&B<A) cout<<"CBA"<<endl;
	}}}
    return 0;
}


/*
 * eatingamount.cpp
 *
 *  Created on: 2013-11-3
 *      Author: ???
 */
int main()
{int a,b,c;
	int A,B,C;
	for(A=1;A<=3;A++)
		for(B=1;B<=3;B++){
			if(A==B)continue;
			for(C=1;C<=3;C++){
				if(A==C||B==C)continue;
				a=(B>A)+(C==A);
				b=(A>B)+(A>C);
				c=(C>B)+(B>A);
					if(a>b&&b>c&&A<B&&B<C){cout<<"ABC";break;}
					if(a>c&&c>b&&A<C&&C<B){cout<<"ACB";break;}
					if(b>a&&a>c&&B<A&&A<C){cout<<"BAC";break;}
					if(b>c&&c>a&&B<C&&C<A){cout<<"BCA";break;}
					if(c>a&&a>b&&C<A&&A<B){cout<<"CAB";break;}
					if(c>b&&b>a&&C<B&&B<A){cout<<"CBA";break;}
			}

		}
		return 0;
}


typedef struct ABC {
	int amount;         // to store the amount they eat
	int statements;     // to store the number of the true statements
	char name;          // to store the name A, B, C
} ABC;

int main() {
	ABC p1, p2, p3;
	p1.name = 'A';
	p2.name = 'B';
	p3.name = 'C';
	for(p1.amount = 0; p1.amount < 3; p1.amount++) {
		for(p2.amount = 0; p2.amount < 3; p2.amount++) {
			for(p3.amount = 0; p3.amount < 3; p3.amount++)  {// use 0,1,2 to mean the amount they eat
				p1.statements = (p2.amount > p1.amount) + (p3.amount == p1.amount);  // to calculate the true statements
				p2.statements = (p1.amount > p2.amount) + (p1.amount > p3.amount);
				p3.statements = (p3.amount > p2.amount) + (p2.amount > p1.amount);
				int a, b, c;                            // to check whether they are in the right order
				a = (p1.amount > p2.amount && p1.statements < p2.statements) || (p1.amount < p2.amount && p1.statements > p2.statements);
				b = (p1.amount > p3.amount && p1.statements < p3.statements) || (p1.amount < p3.amount && p1.statements > p3.statements);
				c = (p3.amount > p2.amount && p3.statements < p2.statements) || (p3.amount < p2.amount && p3.statements > p2.statements);
				if(a + b + c == 3) {
					int temp1;  // the middle values used for switch the values
					char temp2;
					if(p1.amount > p2.amount) {      // give A,B,C a right order
						temp1 = p1.amount;
						p1.amount = p2.amount;
						p2.amount = temp1;
						temp2 = p1.name;
						p1.name = p2.name;
						p2.name = temp2;
					}
					if(p1.amount > p3.amount) {
						temp1 = p1.amount;
						p1.amount = p3.amount;
						p3.amount = temp1;
						temp2 = p1.name;
						p1.name = p3.name;
						p3.name = temp2;
					}
					if(p2.amount > p3.amount) {
						temp1 = p3.amount;
						p3.amount = p2.amount;
						p2.amount = temp1;
						temp2 = p3.name;
						p3.name = p2.name;
						p2.name = temp2;
					}
					cout << p1.name << p2.name << p3.name << endl;  // output

					return 0;
				}
				}

		}
	}
	return 0;
}


int main()
{
	int a,b,c;
	for (a=0;a<=2;a++)
		for (b=0;b<=2;b++)
			for (c=0;c<=2;c++)
			{
				if (((a>b)+(c==a))==a && ((a<b)+(a<c))==b && ((c<b)+(b<a))==c )
				{
					if (b>c&&c>a)
						    cout<<"BCA";
					else if (a>c&&c>b)
					        cout<<"ACB";
					else if (b>a&&a>c)
					        cout<<"BAC";
					else if (a>b&&b>c)
						    cout<<"ABC";
					else if (c>a&&a>b)
						    cout<<"CAB";
					else if (c>b&&b>a)
						cout<<"CBA";

				}
			}
return 0;
}


/**
 * ??? ???
 * ??? 1000012844
 * ??? ???
 **/

int main()
{
	int i, j;
	int amount[ 3 ];
	int truth[ 3 ];
	char name[ 3 ] = { 'A', 'B', 'C' };
	int smallest;

	for ( amount[ A ] = 1; amount[ A ] <= 3; amount[ A ]++ )
	{
		for ( amount[ B ] = 1; amount[ B ] <= 3; amount[ B ]++ )
		{
			for ( amount[ C ] = 1; amount[ C ] <= 3; amount[ C ]++ )
			{
				truth[ A ] = ( amount[ B ] > amount[ A ] ) + ( amount[ C ] == amount[ A ] );
				truth[ B ] = ( amount[ A ] > amount[ B ] ) + ( amount[ A ] > amount[ C ] );
				truth[ C ] = ( amount[ C ] > amount[ B ] ) + ( amount[ B ] > amount[ A ] );

				if ( ( ( ( truth[ A ] > truth[ B ] ) && ( amount[ A ] < amount[ B ] ) )
					|| ( ( truth[ A ] == truth[ B ] ) && ( amount[ A ] == amount[ B ] ) ) ||
					( ( truth[ A ] < truth[ B ] ) && ( amount[ A ] > amount[ B ] ) ) ) &&
					( ( ( truth[ C ] > truth[ B ] ) && ( amount[ C ] < amount[ B ] ) )
					|| ( ( truth[ C ] == truth[ B ] ) && ( amount[ C ] == amount[ B ] ) ) ||
					( ( truth[ C ] < truth[ B ] ) && ( amount[ C ] > amount[ B ] ) ) ) &&
					( ( ( truth[ A ] > truth[ C ] ) && ( amount[ A ] < amount[ C ] ) )
					|| ( ( truth[ A ] == truth[ C ] ) && ( amount[ A ] == amount[ C ] ) ) ||
					( ( truth[ A ] < truth[ C ] ) && ( amount[ A ] > amount[ C ] ) ) ) )
				{
					for ( i = 1; i <= 3; i++ )
					{
						for ( j = 0; j <= 2; j++ )
						{
							if ( amount[ j ] == i )
							{
								cout << name[ j ];
							}
						}
					}
				}

			}
		}
	}
}


int main()
{
   int a,b,c;
  for(a=0;a<=2;a++)
   for(b=0;b<=2;b++)
    {
      if(a==b)
      continue;
    }
     for(c=0;c<=2;c++)
      {
        if(a==b&&b==c)
         continue;
        else

         cout<<"BCA"<<endl;
         break;
       }
 return 0;
}


/*
 * 70.cpp
 * ???
 *  Created on: 2012-9-16
 *      Author: Salforever
 */

int main(void)
{
	int A, B, C;
	int As, Bs, Cs;
	int AnsA, AnsB, AnsC;									//????
	for (A=1; A<=3; A++)
		for (B=1; B<=3; B++)
			for (C=1; C<=3; C++)								//????
			{
				As=(B>A)+(C==A);
				Bs=(A>B)+(A>C);
				Cs=(C>B)+(B>A);								//??????
				if ((A+As==3)&&(B+Bs==3)&&(C+Cs==3))	//????????
				{
					AnsA=A;
					AnsB=B;
					AnsC=C;
				}
			}
	if (AnsA<=AnsB && AnsB<=AnsC)
		cout << "ABC" << endl;
	if (AnsA<=AnsC && AnsC<=AnsB)
		cout << "ACB" << endl;
	if (AnsB<=AnsA && AnsA<=AnsC)
		cout << "BAC" << endl;
	if (AnsB<=AnsC && AnsC<=AnsA)
		cout << "BCA" << endl;
	if (AnsC<=AnsA && AnsA<=AnsB)
		cout << "CAB" << endl;
	if (AnsC<=AnsB && AnsB<=AnsA)
		cout << "CBA" << endl;								//????
	return 0;												//????
}


int prime(int);
int main()
{
	int a,b,c;
	for(int a=1;a<=3;a++)
	{
		for(int b=1;b<=3;b++)
		{
			if(b==a) continue;
			for(int c=1;c<=3;c++)
			{
				if(c==a||c==b) continue;
				int A=(b>a)+(c==a);
				int B=(a>b)+(a>c);
				int C=(c>b)+(b>a);
				if(A+a==3&&B+b==3&&C+c==3)
					for(int i=1;i<=3;i++)
					{
						if(i==a)
							cout<<"A";
						if(i==b)
							cout<<"B";
						if(i==c)
							cout<<"C";
					}
			}
		}
	}
	return 0;
}


int main ()
{
	int A, B, C, k;
	int ans, bns, cns;
	k =0;
	for( A =1; A < 4; A ++ )
	{
		for( B = 1; B < 4; B ++)
		{
			for( C = 1; C < 4; C ++ )
			{
				ans = (B > A) + ( C == A);
				bns = (A > B) + ( A > C );
				cns = (C > B) + ( B > A );

				if((A >= B && ans >= bns) || (A >= C && ans >= cns)
					||( B >= C && bns >= cns )|| (A <= B && ans <= bns) || (A <= C && ans <= cns)||( B <= C && bns <= cns ))
					continue;
				else
				{
					k = 1;
				if( A <= B && B <= C)
					cout << "ABC" << endl;
				else if( A <= C && C <= B)
					cout << "ACB" << endl;
				else if(B <=A && A <= C)
					cout << "BAC" <<endl;
				else if(B <=C && C <= A)
					cout << "BCA" <<endl;
				else if(C <= A && A <= B)
					cout << "CAB" << endl;
				else
					cout << "CBA" << endl;

				break;
				}
				if( k ==1 )
					break;
			}
               if( k ==1 )
					break;
		}
	             if( k ==1 )
					break;
	}
			return 0;
}


/*
 * bifanliang.cpp
 *
 *  Created on: 2012-10-26
 *      Author: 99006
 */

int main (){
	int a,b,c;
	int ia(int,int,int);
	int ib(int,int,int);
	int ic(int,int,int);
	void out(int,int,int);
	for (a=0;a<=2;a++)
		for (b=0;b<=2;b++){
			if (a==b) continue;
			c=3-a-b;
			if (a+ia(a,b,c)==2&&b+ib(a,b,c)==2&&c+ic(a,b,c)==2)
				out(a,b,c);

		}
	return 0;
}
int ia (int a,int b,int c){
	int i=0;
	if (b>a) i++;
	if (c==a) i++;
	return i;
}
int ib (int a,int b,int c){
	int i=0;
	if (a>b) i++;
	if (a>c) i++;
	return i;
}
int ic (int a,int b,int c){
	int i=0;
	if (c>b) i++;
	if (b>a) i++;
	return i;
}
void out (int a,int b,int c){
	for (int i=0;i<=2;i++){
		if (a==i) cout<<"A";
		else if (b==i) cout<<"B";
			 else cout<<"C";
	}
}


/*
 * bifanliang.cpp
 *
 *  Created on: 2010-11-17
 *      Author: Administrator
 *      ???????
 */
int main() {
	int A, B, C, As, Bs, Cs;
	for (A = 0; A <= 2; A++)
		for (B = 0; B <= 2; B++)
			for (C = 0; C <= 2; C++) {

				As = (B > A) + (A == C);
				Bs = (A > B) + (A > C);
				Cs = (C > B) + (B > A);
				if ((A + As == 2) && (B + Bs == 2) && (C + Cs == 2)) {
					if ((A < B) && (B < C))
						cout << "ABC" << endl;
					else if ((A < C) && (C < B))
						cout << "ACB" << endl;
					else if ((B < A) && (A < C))
						cout << "BAC" << endl;
					else if ((B < C) && (C < A))
						cout << "BCA" << endl;
					else if ((C < B) && (B < A))
						cout << "CBA" << endl;
					else if ((C < A) && (A < B))
						cout << "CAB" << endl;
				}
			}
	return 0;
}


int main()
{
	int a,b,c,a1,b1,c1,a2,b2,c2,sum1,sum2,sum3,find;
	for(a=0;a<=2;a++)
	{if(find==1)
			{break;}
		for(b=0;b<=2;b++)
		{if(find==1)
			{break;}
			for(c=0;c<=2;c++)
			{

                a1=b>a;
				a2=a==c;
				b1=a>b;
				b2=a>c;
				c1=c>b;
				c2=b>a;
               sum1=a1+a2;
			   sum2=b1+b2;
			   sum3=c1+c2;

				   if(a>=b&&a>=c&&b>=c&&sum1<=sum2&&sum1<=sum3&&sum2<=sum3)
				   {
					   cout<<"ABC",find=1;break;
				   }
				   else if(a>=c&&a>=b&&c>=b&&sum1<=sum3&&sum1<=sum2&&sum3<=sum2)
				   {
					   cout<<"ACB",find=1;break;
                   }
				   else if(b>=c&&b>=a&&a>=c&&sum2<=sum3&&sum2<=sum1&&sum1<=sum3)
				   {
					   cout<<"BAC",find=1;break;
                   }
				   else if(b>=c&&b>=a&&c>=a&&sum2<=sum3&&sum2<=sum1&&sum3<=sum1)
				   {
					   cout<<"BCA",find=1;break;
                   }
				   else if(c>=a&&c>=b&&a>=b&&sum3<=sum1&&sum3<=sum2&&sum1<=sum2)
				   {
					   cout<<"CAB",find=1;break;
                   }
				   else if(c>=a&&c>b&&b>=a&&sum3<=sum1&&sum3<sum2&&sum2<=sum1)
				   {
					   cout<<"CBA",find=1;break;
                   }

			}
		}
	}

				return 0;
}


//???

int main()
{
    int a, b, c, righta, rightb, rightc;
    char fir , sec , thi;
    for(a = 1 ; a <= 3 ; a++)
    {
        for(b = 1 ; b <= 3 ; b++)
        {
            for(c = 1 ; c <= 3 ; c++)
            {
                righta = (b < a) + (c == a);
                rightb = (a < b) + (a < c);
                rightc = (c < b) + (b < a);
                if(((a < b && righta < rightb) || (a == b && righta == rightb) || (a > b && righta > rightb))
                   && ((c < b && rightc < rightb) || (c == b && rightc == rightb) || (c > b && rightc > rightb))
                   && ((a < c && righta < rightc) || (a == c && righta == rightc) || (a > c && righta > rightc)))
                   {
                       if (a == 1)
                           fir = 'A';
                       if (b == 1)
                           fir = 'B';
                       if (c == 1)
                           fir = 'C';
                       if (a == 2)
                           sec = 'A';
                       if (b == 2)
                           sec = 'B';
                       if (c == 2)
                           sec = 'C';
                       if (a == 3)
                           thi = 'A';
                       if (b == 3)
                           thi = 'B';
                       if (c == 3)
                           thi = 'C';
                       cout<<thi<<sec<<fir<<endl;
                   }
            }
        }
    }
    return 0;
}


int main(){
	int a, b, c;
	int ra, rb, rc;
	char res[4];

	for (a = 0; a < 3; a++)
		for (b = 0; b < 3; b++){
			if (b == a)	continue;
			for (c = 0; c < 3; c++){
				if (c == a || c == b)	continue;
				ra = rb = rc = 0;

				ra = (b > a) + (c == a);
				rb = (a > b) + (a > c);
				rc = (c > b) + (b > a);

				if ((a > b && ra > rb)
					|| (a > c && ra > rc)
					|| (b > c && rb > rc))
					continue;

				res[a] = 'A';
				res[b] = 'B';
				res[c] = 'C';
				res[3] = '\0';
			}
		}
	cout << res << endl;
	return 0;
}


//*****************************
//*???
//******************************
int main()
{
	int A,B,C;
	int sumA,sumB,sumC;
	sumA=(B>A)+(C==A);
	sumB=(A>B)+(A>C);
	sumC=(C>B)+(B>A);
	if(A>B&&B>C&&sumA<sumB&&sumB<sumC)
		cout<<"CBA"<<endl;
	if(A>C&&C>B&&sumA<sumC&&sumC<sumB)
		cout<<"BCA"<<endl;
	if(B>A&&A>C&&sumB<sumA&&sumA<sumC)
		cout<<"CAB"<<endl;
	if(B>C&&C>A&&sumB<sumC&&sumC<sumA)
		cout<<"ACB"<<endl;
	if(C>A&&A>B&&sumC<sumA&&sumA<sumB)
		cout<<"BAC"<<endl;
	if(C>B&&B>A&&sumC<sumB&&sumB<sumA)
		cout<<"ABC"<<endl;
	return 0;
}


int main()
{
	int A,B,C;
	int statement[4];
	char rank[4];
	for(A=1;A<=3;A++)
	{
		for(B=1;B<=3;B++)
		{
			if(A==B)continue;
			C=6-A-B;
			statement[A]=((B>A)+(C==A));
			statement[B]=((A>B)+(A>C));
			statement[C]=((C>B)+(B>A));
			rank[A]='A';
			rank[B]='B';
			rank[C]='C';
			if(statement[1]==2&&statement[2]==1&&statement[3]==0)
			{
					cout<<rank[1]<<rank[2]<<rank[3]<<endl;
			}
		}
	}
	return 0;
}


int main()
{
    int afan,bfan,cfan,i,aword,bword,cword;//afan?bfan?cfan??????????? ,aword,bword,cword??????
    char rank[4];//????
    for(afan=1;afan<=3;afan++)
    {
       for(bfan=1;bfan<=3;bfan++)
       {
          if (afan==bfan) continue;//??????
             for(cfan=1;cfan<=3;cfan++)
                {
                                      if ((afan==cfan)||(bfan==cfan)) continue;
                                      aword=(bfan<afan)+(cfan==afan)+1;
                                      bword=(afan<bfan)+(afan<cfan)+1;
                                      cword=(cfan<bfan)+(bfan<afan)+1;
                                      if ((afan==aword)+(bfan==bword)+(cfan==cword)==3)
                                      {
                                            rank[afan]='A';
                                            rank[bfan]='B';
                                            rank[cfan]='C';
                                      }
                }
       }
    }
    for(i=3;i>0;i--) cout<<rank[i];
    return 0;
}


int main()
{
	int adet(int a,int b,int c);
	int bdet(int a,int b,int c);
	int cdet(int a,int b,int c);
	int A=0,B=0,C=0;
	int a=0,b=0,c=0;
	int af=0,bf=0,cf=0;
	int num1[6]={10,10,5,5,1,1};
	int num2[6]={5,1,10,1,10,5};
	int num3[6]={1,5,1,10,5,10};
	int i=0;

	for (i=0;i<6;i++)
	{
		A=num1[i];
		B=num2[i];
		C=num3[i];

	if (A>B&&A>C)
		{af=0;
		if (B>C){bf=1 ;cf=2;}
		else {bf=2;cf=1;}
		}
	else if (A>B&&A<C)
	{
		af=1;bf=2;cf=0;
	}
	else if (A>C&&A<B)
	{
		af=1;bf=0;cf=2;
	}
	else if (A<B&&A<C)
	{
		af=2;
		if (B>C){bf=0 ;cf=1;}
		else {bf=1;cf=0;}
	}

	a=adet(A,B,C);
	b=bdet(A,B,C);
	c=cdet(A,B,C);

	if (af==a&&bf==b&&cf==c)
	{
		switch(i)
		{
		case 0:
			cout<<"CBA"<<endl;
			break;
		case 1:
			cout<<"BCA"<<endl;
			break;
		case 2:
			cout<<"CAB"<<endl;
			break;
		case 3:
			cout<<"BAC"<<endl;
			break;
		case 4:
			cout<<"ACB"<<endl;
			break;
		case 5:cout<<"ABC"<<endl;
		    break;
		}

	}
	}
	return 0;

}
int adet(int a,int b,int c)
{
	int x=0;
	if (b>a)x=x+1;
	if (c==a)x=x+1;
	return (x);

}
int bdet(int a,int b,int c)
{
	int x=0;
	if (a>b)x=x+1;
	if (c<a)x=x+1;
	return (x);
}
int cdet(int a,int b,int c)
{
	int x=0;
	if (c>b)x=x+1;
	if (b>a)x=x+1;
	return (x);
}


int main()
{
  int i,j,k;
  int As,Bs,Cs;
  int Aans,Bans,Cans;
  for(i=0;i<3;i++)
    for(j=0;j<3;j++)
      for(k=0;k<3;k++)
        {
		  if(!((i<=j&&As<=Bs)||(i<=k&&As<=Cs)||(j<=i&&Bs<=As)||(j<=k&&Bs<=Cs)||(k<=i&&Cs<=As)||(k<=j&&Cs<=Bs)))
			{  Aans=i;
		      Bans=j;
			  Cans=k;}
	  }
	  if((Aans>=Bans)&&(Bans>=Cans))
		  cout<<"ABC"<<endl;
	  if((Aans>=Cans)&&(Cans>=Bans))
		  cout<<"ACB"<<endl;
           if((Bans>=Aans)&&(Aans>=Cans))
		  cout<<"BAC"<<endl;
	  if((Bans>=Cans)&&(Cans>=Aans))
                    cout<<"BCA"<<endl;
           if((Cans>=Aans)&&(Aans>=Bans))
                    cout<<"CAB"<<endl;
           if((Cans>=Bans)&&(Bans>=Aans))
                    cout<<"CBA"<<endl;
return 0;
}


int pa(int i,int j,int k)
{
	int d=0;
	if(i==0)
	{
		if(j>=i&&k!=i)
		d=1;
		return d;
	}
	if(i==1)
	{
		if((j>=i&&k==i)||(j<i&&k!=i))
		d=1;
		return d;
	}
	if(i==2)
	{
		if(j<i&&k==i)
		d=1;
		return d;
	}
}
int pb(int i,int j,int k)
{
	int d=0;
	if(j==0)
	{
		if(j<=i&&k<=i)
		d=1;
		return d;
	}
		if(j==1)
	{
		if((j>i&&k<=i)||(j<=i&&k>i))
		d=1;
		return d;
	}
		if(j==2)
	{
		if(j>i&&k>i)
		d=1;
		return d;
	}
}
int pc(int i,int j,int k)
{
	int d=0;
	if(k==0)
	{
		if(k>=j&&j>=i)
		d=1;
		return d;
	}
	if(k==1)
	{
		if((k<j&&j>=i)||(k>=j&&j<i))
		d=1;
		return d;
	}
	if(k==2)
	{
		if(k<j&&j<i)
		d=1;
		return d;
	}
}
main()
{
	int i,j,k,e;
	for(i=0;i<3;i++)
	{
	for(j=0;j<3;j++)
	{
		if(j==i) continue;
		else
		{
			for(k=0;k<3;k++)
			{
				if(k==i||k==j) continue;
				else
				{
					e=pa(i,j,k);
					if(e==0) continue;
					else
					{
					e=pb(i,j,k);
					if(e==0) continue;
					else
					{
					e=pc(i,j,k);
					if(e==0) continue;
					else break;
					}
					}
				}
			}
			if(e==1) break;
		}
	}
	if(e==1) break;
	}
	if(i==2) printf("A");
	if(j==2) printf("B");
	if(k==2) printf("C");
	if(i==1) printf("A");
	if(j==1) printf("B");
	if(k==1) printf("C");
	if(i==0) printf("A");
	if(j==0) printf("B");
	if(k==0) printf("C");
}


int main()
{
    int A, B, C;
    int suma, sumb, sumc;
    for (A = 0; A <= 2; A++)
    {
        for (B = 0; B <= 2; B++)
        {
            for (C = 0; C <= 2; C++)
            {
                suma = (B > A) + (C == A);
                sumb = (A > B) + (A > C);
                sumc = (C > B) + (B > A);
                if (!(A <= B && suma <= sumb || A <= C && suma <= sumc || B <= C && sumb <= sumc ||
                A >= B && suma >= sumb || A >= C && suma >= sumc || B >= C && sumb >= sumc))
                {
                     if (suma == sumb)
                     {
                              if (sumc >= suma)
                              cout << "BAC" << endl;
                              else
                              cout << "CBA" << endl;
                     }
                     if (suma > sumb)
                     {
                                  if (sumc >= suma)
                                  cout << "CAB" << endl;
                                  if (sumc <= sumb)
                                  cout << "ABC" << endl;
                                  else
                                  cout << "ACB" << endl;
                     }
                     if (suma < sumb)
                     {
                                  if (sumc >= sumb)
                                  cout << "CBA" << endl;
                                  if (sumc <= suma)
                                  cout << "BAC" << endl;
                                  else
                                  cout << "BCA" << endl;
                     }
                }
            }
        }
    }
    return 0;
}


int main()
{
	int a, b, c, Ca, Cb, Cc,RA, RB, RC;
	for(a=0;a<=2;a++)
	{
		for(b=0;b<=2;b++)
		{
			if(b==a) continue;
			else
			{
				c=3-a-b;
				Ca=(b>a);
				Cb=(a>b)+(a>c);
				Cc=(c>b)+(b>a);
				if ((Ca+a==2)&&(Cb+b==2)&&(Cc+c==2))
				{RA=a;RB=b;RC=c;}

			}
		}
	}
	if(RA>RB&&RB>RC) cout << "CBA";
	if(RA>RC&&RA>RB) cout << "BCA";
	if(RB>RA&&RA>RC) cout << "CAB";
	if(RB>RC&&RC>RA) cout << "ACB";
	if(RC>RA&&RA>RB) cout << "BAC";
	if(RC>RB&&RB>RA) cout << "ABC";
	return 0;
}


int MAX(int a, int b, int c)
{
	int t=0;
	if (a>b)
		t=a;
	if (c>t)
		t=c;
	return t;
}

int MIN(int a, int b, int c)
{
	int t=0;
	if (a<b)
		t=a;
	if (c<t)
		t=c;
	return t;
}

int main()
{
	int A, B, C;
	int a, b, c;
	int e, f, g;
	char first, second, third;
	for (A = 1; A <= 3; A++)
	{
		for (B = 1; B < 4; B++)
		{
			for (C = 1; C < 4; C++)
			{
				a = (B > A) + (C == A);
				b = (A > B) + (A > C);
				c = (C > B) + (B > A);
				if (((A>B&&a<b)||(A<B&&a>b))+((A>C&&a<c)||(A<C&&a>c))+((B>C&&b<c)||(B<C&&b>c))==3)
				{
					e = MAX(a, b, c);
					g = MIN(a, b, c);
					f = a+b+c-e-g;
				}
			}
		}
	}
	first = 65 + e;
	second = 65 + f;
	third = 65 + g;
	cout << first << second << third << endl;
	return 0;
}


int main()
{
	int A,B,C,a,b,c;
	for(A=1;A<=3;A++)
	{
		for(B=1;B<=3;B++)
		{
			for(C=1;C<=3;C++)
			{
				a=(B>A)+(C==A);
				b=(A>B)+(A>C);
				c=(C>B)+(B>A);
				if(a>b&&b>c)
				{
					cout<<"CBA"<<endl;
					return 0;
				}
				if(a>c&&c>b)
				{
					cout<<"BCA"<<endl;
					return 0;
				}
				if(b>a&&a>c)
				{
					cout<<"CAB"<<endl;
					return 0;
				}
				if(b>c&&c>a)
				{
					cout<<"ACB"<<endl;
					return 0;
				}
				if(c>a&&a>b)
				{
					cout<<"BAC"<<endl;
					return 0;
				}
				if(c>b&&b>a)
				{
					cout<<"ABC"<<endl;
					return 0;
				}
			}
		}
	}
}


main()
{
      char a,b,c,A,B,C;
      a=C;
      b=A;
      c=B;
      printf("BCA");
      getchar();
}


int main()
{
	void output(int a,int b,int c,int k);
	int a,b,c;
	for(a=1;a<=3;a++)
		for(b=1;b<=3;b++)
		{
			c=6-a-b;
			if(a*b*c==6&&((b>a)+(c==a)==3-a&&(a>b)+(a>c)==3-b&&(c>b)+(b>a)==3-c))
			{
				output(a,b,c,1);
				output(a,b,c,2);
				output(a,b,c,3);
			}
        }
		return 0;
}

void output(int a,int b,int c,int k)
{
	if (a==k)cout<<"A";
    else if(b==k)cout<<"B";
	else cout<<"C";
}


struct l
{
       char s[10];
       float h;
} a[40];
main()
{
      int i=0,j=0,k=0,w=0,n;
      float b[40],c[40],tmp=0;
      scanf("%d",&n);
      for(i=0;i<=n-1;i++)
      scanf("%s%f",a[i].s,&a[i].h);
      for(i=0;i<=n-1;i++)
      {

                         if(strcmp(a[i].s,"male")==0)
                         {b[j]=a[i].h;j++;}
                         if(strcmp(a[i].s,"female")==0)
                         {c[k]=a[i].h;k++;}
      }
      for(w=j-1;w>0;w--)
      {
      for(i=0;i<=j-2;i++)
      {if(b[i]>b[i+1])
      {tmp=b[i+1];
       b[i+1]=b[i];
       b[i]=tmp;
                     }}}
                     for(w=k-1;w>0;w--)
                     {
       for(i=0;i<=k-2;i++)
      {if(c[i]<c[i+1])
      {tmp=c[i+1];
       c[i+1]=c[i];
       c[i]=tmp;
                     }}}
                     for(i=0;i<=j-1;i++)
                     printf("%.2f ",b[i]);
                      for(i=0;i<=k-2;i++)
                     printf("%.2f ",c[i]);
                     printf("%.2f",c[i]);

      getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}


double male[40];
double female[40];
char str[10];

int cmp1(const void *a,const void *b)//up
{
  return *(double *)a < *(double *)b;
}

int cmp2(const void *a,const void *b)//down
{
  return *(double *)b < *(double *)a;
}

int main()
{
  int i,n,maleindex,femaleindex;
  double temp;
  while(cin>>n)
  {
	maleindex = femaleindex = 0;
	while(n--)
	{
		cin>>str>>temp;
		if(strcmp(str,"male") == 0)
		  male[maleindex++] = temp;
		else
		  female[femaleindex++] = temp;
	}

	qsort(male,maleindex,sizeof(male[0]),cmp2);
    qsort(female,femaleindex,sizeof(female[0]),cmp1);

	printf("%.2lf",male[0]);
	for(i = 1;i < maleindex;i++)
	  printf(" %.2lf",male[i]);

	for(i = 0;i < femaleindex;i++)
	  printf(" %.2lf",female[i]);
	printf("\n");
  }
  return 0;
}


int compare1( const void *a , const void *b)
{
	int *p = (int *)a;
	int *q = (int *)b;
	if(*p > *q)
	{
		return 1;
	}
	else if(*p == *q)
	{
		return 0;
	}
	else
	{
		return -1;
	}
}//nv

int compare2( const void *a ,  const void *b)
{
	int *p = (int *)a;
	int *q = (int *)b;
	if(*p > *q)
	{
		return -1;
	}
	else if(*p == *q)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}//nan

int main(int argc, char* argv[])
{
	int male = 0;
	int female = 0;
	int n;
	int i;
	float a[40];
	float b[40];
	char c[10];
	float d;
	scanf("%d" , &n);
	for(i = 0 ; i < n ; i++)
	{
		scanf("%s" , c);
		if(!strcmp(c , "male"))
		{
			scanf("%f" , &d);
			a[male] = d;
			male++;
		}
		else
		{
			scanf("%f" , &d);
			b[female] = d;
			female++;
		}
	}
	//painansheng
	qsort(a , male , sizeof(float) , compare1);
	qsort(b , female , sizeof(float) , compare2);
	for(i = 0 ; i < male ; i++)
	{
		printf("%.2f " , a[i]);
	}
	for(i = 0 ; i < female ; i++)
	{
		printf("%.2f" , b[i]);
		if(i != female-1)
		{
			printf(" ");
		}
	}
	printf("\n");

	return 0;

}


double f[100];
double g[100];

int main()
{
	int m=0,n=0;
	int t;
	cin >>t;
	int i;
	while (t--)
	{
		double tmp;
		char sx[10];
		cin >>sx;
		cin >>tmp;
		if (strcmp(sx,"male") == 0) f[m++]=tmp;
		else g[n++]=tmp;
	}
	sort(f,f+m);
	sort(g,g+n);
	for (i=0;i<m;i++) printf("%.2f ", f[i]);
	for (i=n-1;i>=0;i--)
	{
		if (i!=0)
			printf("%.2f ", g[i]);
		else
			printf("%.2f", g[i]);
	}
	cout <<endl;
	return 0;
}


int main(){
	double sg[40],male[40],female[40],e;
	char xb[40][7];
	int n,i,j,l,k;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",xb[i],&sg[i]);
	}
	j=0;
	k=0;
	int result;
	for(i=0;i<n;i++){
		result=strcmp(xb[i],"male");
		if(result==0){
			male[j]=sg[i];
			j++;
		}else{
			female[k]=sg[i];
			k++;
		}
	}
	for(l=1;l<=j;l++){
		for(i=0;i<j-l;i++){
			if(male[i]>male[i+1]){
				e=male[i+1];
				male[i+1]=male[i];
				male[i]=e;
			}
		}
	}
	for(l=1;l<=k;l++){
		for(i=0;i<k-l;i++){
			if(female[i]<female[i+1]){
				e=female[i+1];
				female[i+1]=female[i];
				female[i]=e;
			}
		}
	}
	for(i=0;i<j;i++){
		printf("%.2lf ",male[i]);
	}
	for(i=0;i<k-1;i++){
		printf("%.2lf ",female[i]);
	}
	printf("%.2lf",female[k-1]);
return 0;
}


int compare1(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int compare2(const void* a, const void* b){
	return *(int*)b - *(int*)a;
}

int main(){
	float a[41],b[41];
	for(int i = 0; i < 41; i++){
		a[i] = -1;
		b[i] = -1;
	}

	int n;
	cin>>n;
	int aa = 0,bb = 0;
	for(int i = 0; i < n; i++){
		char temp[10];
		cin>>temp;
		float height;
		cin>>height;
		if(temp[0] == 'm'){
			a[aa] = height;
			aa++;
		}else{
			b[bb] = height;
			bb++;
		}
	}

	qsort(a,aa,sizeof(int),compare1);
	qsort(b,bb,sizeof(int),compare2);

	for(int i = 0; i < aa; i++)
		printf("%.2f ", a[i]);
	for(int i = 0; i < bb; i++){
		if(i == bb - 1){
			printf("%.2f", b[i]);
		}else{
			printf("%.2f ", b[i]);
		}
	}

	//cin>>n;

}


struct student
{
       char sex[7];
       float h;
};
main()
{
      struct student a[41],t;
      int i,j,k,n,count1=0,count2=0;
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
           scanf("%s%f",a[i].sex,&a[i].h);
      }
      for(i=0;i<n;i++)
      {
             if(strcmp(a[i].sex,"male")==0)
             count1++;
             else
             count2++;
      }
      for(i=0;i<n-1;i++)
      {
          for(j=i+1;j<n;j++)
          {
                if(a[i].h>a[j].h)
                {
                t=a[i];
                a[i]=a[j];
                a[j]=t;
                }
          }
      }
      for(i=0;i<n;i++)
      {
             if(strcmp(a[i].sex,"male")==0)
             printf("%.2f ",a[i].h);
      }
      int count=0;
      for(i=n-1;i>=0;i--)
      {
             if(strcmp(a[i].sex,"female")==0)
             {
                       if(count!=count2-1)
                       {
                       printf("%.2f ",a[i].h);
                       count++;
                       }
                       else
                       printf("%.2f",a[i].h);
             }

      }
      getchar();
      getchar();
}


void line(int n,float *p);
int main()
{
    struct people
    {
           char gender[10];
           float tall;
    };
    struct people people[45];
    int n,i,j,k,flag;
    j=k=0;flag=1;
    float m[45],f[45];
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%s %f",&people[i].gender,&people[i].tall);
    for(i=0;i<n;i++)
    {
                    if(people[i].gender[0]=='m')
                    {
                                                m[j]=people[i].tall;j++;
                    }
                    else
                    {
                         f[k]=people[i].tall;k++;
                    }
    }
    line(j,m);
    line(k,f);
    for(i=0;i<j;i++)
    {
                    if(flag)
                    {
                            printf("%.2f",m[i]);flag=0;
                    }
                    else printf(" %.2f",m[i]);
    }
    for(i=k-1;i>=0;i--)printf(" %.2f",f[i]);
    return 0;
}
void line(int n,float *p)
{
     int i,j;
     float k;
     for(i=0;i<n-1;i++)
     {
                     for(j=0;j<n-1-i;j++)
                     {
                                       if(p[j]>p[j+1])
                                       {
                                                      k=p[j];
                                                      p[j]=p[j+1];
                                                      p[j+1]=k;
                                       }
                     }
     }
}


struct TIME
{
	int start,end;
};
int mycp(const void * e1,const void * e2)
{
	return  *(const int *) e1 - *(const int *) e2;
}
int mycp1(const void * e1,const void * e2)
{
	return  *(const int *) e1 - *(const int *) e2;
}
int mycp2(const void * e1,const void * e2)
{
	return  *(const int *) e2 - *(const int *) e1;
}
int main()
{
	int n =0;
	scanf("%d",&n);
	float man[40],female[40];
	int intman[40],intfemale[40];
	int nm=0,nf=0;
	float temph;
	char gen[10];
	while (n -- )
	{

		scanf("%s %f",gen,&temph);
		if(gen[0] == 'm') {
			man[nm] = temph;
			nm ++;
		}
		else if (gen[0] == 'f'){
			female[nf] = temph;
			nf ++;
		}
	}
	for (int i = 0; i< nm; i++)
	{
		intman[i] = 1000 * man[i];
	}
	for (int i = 0; i< nf; i++)
	{
		intfemale[i] = 1000 * female[i];
	}

	qsort(intman,nm,sizeof(int),mycp1);
	qsort(intfemale,nf,sizeof(int),mycp2);

	for (int i = 0; i< nm; i++)
	{
		man[i] = (float)intman[i] / 1000;
	}
	for (int i = 0; i< nf; i++)
	{
		female[i] = (float)intfemale[i]/1000;
	}
	for(int i = 0; i <nm ; i++)
		printf("%.2f ",man[i]);
	for(int i = 0; i <nf ; i++)
		if (i == nf -1)		printf("%.2f\n",female[i]);
		else printf("%.2f ",female[i]);

	getchar();getchar();
	return 1;
}


void h(double a[],int n)
{
   double m;
   int i,j;
   for(i=0;i<n-1;i++)
   {
     for(j=i+1;j<n;j++)
     {
        if(a[i]>a[j])
        {
          m=a[i];
          a[i]=a[j];
          a[j]=m;
        }
     }
   }

}
main()
{
       int n,j,i;
       scanf("%d",&n);
       int*p=(int*)malloc(n*sizeof(int));
       double*q=(double*)malloc(n*sizeof(double));
       char c[10];
       int m=0,f=0;
       for(int i=0;i<n;i++)
       {
          scanf("%s %lf",c,&q[i]);
          if(c[0]-'m'==0)
          {p[i]=1;m++;}
          if(c[0]-'f'==0)
          {p[i]=0;f++;}
       }
       double*a=(double*)malloc(m*sizeof(double));
       double*b=(double*)malloc(f*sizeof(double));
       for(i=0,j=0;i<n;i++)
       {
          if(p[i]==1)
          {a[j]=q[i];j++;}
       }
        for(i=0,j=0;i<n;i++)
       {
          if(p[i]==0)
          {b[j]=q[i];j++;}
       }
       h(a,m);
       h(b,f);
       for(i=0;i<m;i++)
       {
        printf("%.2lf ",a[i]);
       }
       for(i=f-1;i>=0;i--)
       {
        if(i==0)
        printf("%.2lf",b[i]);
        else
        printf("%.2lf ",b[i]);
       }
       getchar();
       getchar();
       getchar();
}


int compare(const void *elem1,const void *elem2)
{
    return *(float *)elem1>*(float *)elem2 ?1:-1;
}

main()
{
      int n,i,k1,k2,j1,j2;
      k1=k2=j1=j2=0;
      scanf("%d",&n);
      char p1[10]={'m','a','l','e','\0'};
      char p2[10]={'f','e','m','a','l','e','\0'};

      char a[n][10];
      float b[n];
      float *c,*d;
      for(i=0;i<n;i++)
      {
                      scanf("%s",&a[i]);
                      scanf("%f",&b[i]);
      }

      for(i=0;i<n;i++)
      {
                      if(strcmp(a[i],p1)==0)
                      {
                            k1++;
                      }
                      else if(strcmp(a[i],p2)==0)
                      {
                            k2++;
                      }
      }
      c=(float *)malloc(k1*sizeof(float));
      d=(float *)malloc(k2*sizeof(float));
      for(i=0;i<n;i++)
      {
                      if(strcmp(a[i],p1)==0)
                      {
                            c[j1]=b[i];
                            j1++;
                      }
                      else if(strcmp(a[i],p2)==0)
                      {
                            d[j2]=b[i];
                            j2++;
                      }
      }
      qsort(c,k1,sizeof(float),compare);
      qsort(d,k2,sizeof(float),compare);

      printf("%.2f",c[0]);
      for(i=1;i<k1;i++)printf(" %.2f",c[i]);
      for(i=k2-1;i>=0;i--)printf(" %.2f",d[i]);

}


int n;
double male[50],female[50];
int cntm,cntf;
char sex[10];

int main()
{
    cin>>n;
    cntm=cntf=0;
    for(int i=0;i<n;i++)
    {
            scanf("%s",sex);
            if(strcmp(sex,"male")==0)
                  cin>>male[cntm++];
            else
                cin>>female[cntf++];
    }
    sort(male,male+cntm);
    sort(female,female+cntf);
    for(int i=0;i<cntm;i++)
            printf("%.2f ",male[i]);
    for(int i=cntf-1;i>0;i--)
            printf("%.2f ",female[i]);
    printf("%.2f\n",female[0]);
    return 0;
}


struct ren{
    char sex[8];
    double gao;
}a[45];
main()
{
    int i,j,k,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s %lf",a[i].sex,&a[i].gao);
        }
    for(i=0;i<n;i++)
    {
        if(strcmp(a[i].sex,"female")==0)
        a[i].gao=10-a[i].gao;
        }
    if(n>2)
    {
        for(i=0;i<n-1;i++)
        {
            struct ren temp;
            for(j=1;j<n-i;j++)
            {
                if(a[j].gao<a[j-1].gao)
                {
                    temp=a[j];
                    a[j]=a[j-1];
                    a[j-1]=temp;
                    }
                }
            }
        }
    else
    {
        struct ren temp;
        if(a[0].gao>a[1].gao)
        {
            temp=a[1];
            a[1]=a[0];
            a[0]=temp;
            }
        }
    for(i=0;i<n;i++)
    {
        if(strcmp(a[i].sex,"female")==0)
        a[i].gao=10-a[i].gao;
        }
    for(i=0;i<n;i++)
    {
        if(i==0)
        printf("%.2lf",a[i].gao);
        else
        printf(" %.2lf",a[i].gao);
        }
    }
/*

    for(i=0;i<n;i++)
    {
        printf("%s %lf\n",a[i].sex,a[i].gao);
        }
*/


int main()
{
	char sex[41][7], flag[7] = {'m', 'a', 'l', 'e'};
	double maleheight[40], femaleheight[40], t;
	int n, i, j, m = 1, f = 1;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
        cin >> sex[i];
		if (strcmp(sex[i], flag) == 0)
		{
			cin >> maleheight[m];
			m++;
		}
		else
		{
			cin >> femaleheight[f];
			f++;
		}
	}
	m--;
	f--;
	for (i = 1; i < m; i++)
	{
		for (j = i + 1; j <= m; j++)
		{
			if (maleheight[i] > maleheight[j])
			{
				t = maleheight[i];
				maleheight[i] = maleheight[j];
				maleheight[j] = t;
			}
		}
	}
	for (i = 1; i < f; i++)
	{
		for (j = i + 1; j <= f; j++)
		{
			if (femaleheight[i] < femaleheight[j])
			{
				t = femaleheight[i];
				femaleheight[i] = femaleheight[j];
				femaleheight[j] = t;
			}
		}
	}
	for (i = 1; i <= m; i++)
	{
		cout << fixed << setprecision(2) << maleheight[i] << " ";
	}
	for (i = 1; i <= f; i++)
	{
		cout << fixed << setprecision(2) << femaleheight[i];
		if (i != f)
		{
			cout << " ";
		}
		else
		{
			cout <<endl;
		}
	}
	return 0;
}


struct person
{
    char sex[8];
    double hgt;
};
int compare(const void*a,const void*b)
{
    if((((struct person*)b)->hgt)-(((struct person*)a)->hgt)>0)
    return -1;
    else
    return 1;
}
main()
{
  int i,j,k,m,n;
  struct person a[41];
  scanf("%d",&n);
  for(i=0;i<n;i++)
  scanf("%s %lf",a[i].sex,&a[i].hgt);
  qsort(a,n,sizeof(struct person),compare);
  for(i=0,j=0;i<n;i++)
  for(i=0,j=0;i<n;i++)
  {
      if(a[i].sex[0]=='m')
      {
          if(j==0)
          {
              printf("%.2lf",a[i].hgt);
              j=1;
          }
          else
          printf(" %.2lf",a[i].hgt);
      }
  }
  for(i=n-1;i>=0;i--)
  {
      if(a[i].sex[0]=='f')
      printf(" %.2lf",a[i].hgt);
  }
}


float cmp(float *a,int n)
{
	float temp;
	for(int i=0;i<n;i++)
	{
		for(int j=n-1;j>i;j--)
		{
			if(a[j]<a[j-1])
			{temp=a[j];
			a[j]=a[j-1];
			a[j-1]=temp;
                        }
		}
	}
	return *a;
}
int main()
{
	int n;
	scanf("%d",&n);
	int i=0,j,k,a=0,b=0;
	char sex[10];
	float man[40],woman[40],h;
	while(i<n)
	{
		scanf("%s %f",sex,&h);
		if(sex[0]=='m')
		{
			man[a]=h;
			a++;
		}
		else
		{
			woman[b]=h;
			b++;
		}
		i++;
	}
	cmp(man,a);
	cmp(woman,b);
	printf("%.2f",man[0]);
	for(k=1;k<a;k++)
		printf(" %.2f",man[k]);
	for(k=b-1;k>0;k--)
		printf(" %.2f",woman[k]);
	printf(" %.2f\n",woman[0]);
}


int compare1(const void*a,const void*b){
	return *(int*)a-*(int*)b;
}
int compare2(const void*a,const void*b){
	return *(int*)b-*(int*)a;
}
int main()
{
	float a[41],b[41];
	for(int i=0;i<41;i++)
	{
		a[i]=-1;
		b[i]=-1;
	}
	int n;
	cin>>n;
	int aa=0,bb=0;
	for(int i=0;i<n;i++)
	{
		char temp[10];
		cin>>temp;
		float height;
		cin>>height;
		if(temp[0]=='m')
		{
			a[aa]=height;
			aa++;
		}
		else
		{
			b[bb]=height;
			bb++;
		}
	}
	qsort(a,aa,sizeof(int),compare1);
	qsort(b,bb,sizeof(int),compare2);
	for(int i=0;i<aa;i++)
		printf("%.2f ",a[i]);
	for(int i=0;i<bb;i++)
		if(i==bb-1)printf("%.2f",b[i]);
		else printf("%.2f ",b[i]);
return 0;
}


struct play
{
       char sex[10];
       double h;
};

main()
{
      int n,i,j;
      double t;
      scanf("%d",&n);
      struct play ab[n];
      for(int i=0;i<n;i++)
      {
              scanf("%s %lf",ab[i].sex,&ab[i].h);
      }
      int ma=0;
      int fe=0;
      double nan[50];
      double nv[50];
      for(i=0;i<50;i++)
      {
                       nan[i]=1.0;
                       nv[i]=1.0;
      }
      for(i=0;i<n;i++)
      {
                      if(strcmp(ab[i].sex,"male")==0)
                      {nan[ma]=ab[i].h;
                      ma++;}
                      if(strcmp(ab[i].sex,"female")==0)
                      {
                      nv[fe]=ab[i].h;
                      fe++;
                      }
      }

      for(j=0;j<ma-1;j++)
      {
                for(i=0;i<ma-1-j;i++)
                if(nan[i]>nan[i+1])
                {
                                   t=nan[i];
                                   nan[i]=nan[i+1];
                                   nan[i+1]=t;
                }
      }
        for(j=0;j<fe-1;j++)
      {
                for(i=0;i<fe-1-j;i++)
                if(nv[i]<nv[i+1])
                {
                                   t=nv[i];
                                   nv[i]=nv[i+1];
                                   nv[i+1]=t;
                }
      }
      for(i=0;i<ma;i++)
      printf("%.2lf ",nan[i]);
      for(i=0;i<fe-1;i++)
      printf("%.2lf ",nv[i]);
      printf("%.2lf",nv[fe-1]);

}


double male[40];
double female[40];
int mk,fk;
void sor1(){
	int i,j,tmp;
	double min;
	for(i=0;i<mk;i++){
		min=male[i];
		tmp=i;
		for(j=i+1;j<mk;j++){
			if(min>male[j]){
				min=male[j];
				tmp=j;
			}
		}
		male[tmp]=male[i];
		male[i]=min;
	}

}
void sor2(){
	int i,j,tmp;
	double min;

	for(i=0;i<fk;i++){
		min=female[i];
		tmp=i;
		for(j=i+1;j<fk;j++){
			if(min>female[j]){
				min=female[j];
				tmp=j;
			}
		}
		female[tmp]=female[i];
		female[i]=min;
	}

}

int main(void){
	int n,i;
	char sex[10];

	scanf("%d",&n);
	mk=0;
	fk=0;
	for(i=0;i<n;i++){
		scanf("%s",sex);
		if(sex[0]=='m')
			scanf("%lf",&male[mk++]);
		else
			scanf("%lf",&female[fk++]);
	}
	sor1();
	sor2();
	for(i=0;i<mk;i++)
		printf("%.2f ",male[i]);
	for(i=fk-1;i>0;i--)
		printf("%.2f ",female[i]);
	printf("%.2f\n",female[0]);
}


typedef struct{
	int sex;
	char h[5];
	double height;
}person;

int main(){
	int N;
	int i = 0;
	int count = 0;
	person* line;
	scanf("%d\n", &N);
	line = (person*)malloc(sizeof(person)*N);
	while(i < N){
		char sex;
		char tmp;
		char h[5];
		int k = 0;
		int point = 0;
		int num = 0;
		int j = 0;
		double number;
		int length = 0;
		scanf("%c", &sex);
		while((tmp = fgetc(stdin)) != ' '){
		}

		scanf("%s", &h);
		fgetc(stdin);

		while(h[j] != '\0'){
			line[i].h[j] = h[j];
			j++;
		}
		line[i].h[j] = '\0';

		while(h[k] != '\0'){
			int one = 0;
			if(h[k] == '.'){
				point = k;
			}
			else{
				one = h[k] - 48;
				num = num*10 + one;
			}
			k++;
			length++;
		}
		point = length - point - 1;
		number = (double)num/(pow(10.0,point));

		line[i].height = number;
		if(sex == 'm')
			line[i].sex = 1;
		if(sex == 'f')
			line[i].sex = 0;
		i++;
	}

	i = N-1;
	while(i > 0){
		int k = 0;
		while(k < i){
			if(line[k].height > line[k+1].height){
				person tmp = line[k];
				line[k] = line[k+1];
				line[k+1] = tmp;
			}
			k++;
		}
		i--;
	}

	i = 0;
	while(i < N){
		if(line[i].sex == 1){
			printf("%s", line[i].h);
			count++;
			if(count != N)
			printf(" ");
		else
			printf("\n");
		}

		i++;
	}
	i = N-1;
	while(i >= 0){
		if(line[i].sex == 0){
			printf("%s", line[i].h);
			count++;
			if(count != N)
			printf(" ");
		else
			printf("\n");
		}

		i--;
	}
	return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	char sex[100][10],empty[10];
	double len[100],male[100],female[100];
	int i,m=0,f=0,numm,numf,j;
	for(i=0;i<n;i++)
	{
		gets(empty);
		scanf("%s %lf",sex[i],&len[i]);
		if(sex[i][0]=='m')
		{
			male[m]=len[i];
			m=m+1;
		}
		if(sex[i][0]=='f')
		{
			female[f]=len[i];
			f=f+1;

		}
	}
	double e;
	for(i=0;i<m;i++)
	{
		for(j=1;j<m-i;j++)
		{
			if(male[j]<male[j-1])
			{
				e=male[j-1];
				male[j-1]=male[j];
				male[j]=e;

			}
		}
	}
	for(i=0;i<f;i++)
	{
		for(j=1;j<f-i;j++)
		{
			if(female[j]>female[j-1])
			{
				e=female[j-1];
				female[j-1]=female[j];
				female[j]=e;

			}
		}
	}
	for(i=0;i<m;i++)
		printf("%.2lf ",male[i]);
	for(i=0;i<f;i++)
	{
		if(i==f-1)
			printf("%.2lf",female[i]);
		else
			printf("%.2lf ",female[i]);
	}
	return 0;

}


typedef struct area
{
	char sex[8];
	float hight;
}area;

area a[100];

int cmp(const void *a, const void *b)
{
	area *aa = (area *)a;
	area *bb = (area *)b;
	if (aa->sex[0] == 'm' && bb->sex[0] == 'f')
		return -1;
	else if (aa->sex[0] == 'f' && bb->sex[0] == 'm')
		return 1;
	else if (aa->sex[0] == 'm')
	{
		return aa->hight < bb->hight ? -1 : 1;
	}
	else
		return aa->hight < bb->hight ? 1 : -1;
}

int main()
{
	int n, i;
	//freopen("in.txt", "r", stdin);
	scanf("%d", &n);
	for (i = 0; i < n; i ++)
	{
		scanf("%s%f", &a[i].sex, &a[i].hight);
	}
	qsort(a, n, sizeof (area), cmp);
	for (i = 0; i < n; i ++)
	{
		printf("%.2f", a[i].hight);
if (i < n -1)
printf(" ");
	}
	return 0;
}


int main()
{
    char gender[40][10];
    float maleheight[40], femaleheight[40], temp;
    int num, i, j = 0, k = 0, male = 0, female = 0;
    cin >> num;
    for (i = 0; i < num; i++)
    {
        cin >> gender[i];
        if (gender[i][0] == 'm')
        {
            cin >> maleheight[j];
            j++;
            male++;
        }
        else
        {
            cin >> femaleheight[k];
            k++;
            female++;
        }
    }
    for (i = 0; i < male; i++)
    {
        for (j = 0; j < male - 1 - i; j++)
        {
            if (maleheight[j] - maleheight[j + 1] > 0)
            {
                temp = maleheight[j];
                maleheight[j] = maleheight[j + 1];
                maleheight[j + 1] = temp;
            }
        }
    }
    for (i = 0; i < female; i++)
    {
        for (j = 0; j < female - 1 - i; j++)
        {
            if (femaleheight[j] - femaleheight[j + 1] > 0)
            {
                temp = femaleheight[j];
                femaleheight[j] = femaleheight[j + 1];
                femaleheight[j + 1] = temp;
            }
        }
    }
    cout << fixed << setprecision(2);
    for (i = 0; i < male; i++)
    {
        cout << maleheight[i] << " ";
    }
    for (i = female - 1; i > 0; i--)
    {
        cout << femaleheight[i] << " ";
    }
    cout << femaleheight[0];

    return 0;
}


int main(){
	struct point{
		char a[100];
		double b;
	}points[100];
	int n,i=0,k=1;
	char p[100];
	double d;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",points[i].a,&points[i].b);
	}
	for(k=1;k<=n;k++){
		for(i=0;i<n-k;i++){
			if(points[i].b>points[i+1].b){
				d=points[i+1].b;
				points[i+1].b=points[i].b;
				points[i].b=d;
				strcpy(p,points[i+1].a);
				strcpy(points[i+1].a,points[i].a);
				strcpy(points[i].a,p);
			}
		}
	}
	for(i=0;i<n;i++){
		if(strcmp(points[i].a,"male")==0){
			printf("%.2lf",points[i].b);
			break;
		}
	}

	for(i=i+1;i<n;i++){
		if(strcmp(points[i].a,"male")==0){
             printf(" %.2lf",points[i].b);
		}
	}
	for(i=n-1;i>=0;i--){
		if(strcmp(points[i].a,"female")==0){
			printf(" %.2lf",points[i].b);
		}
	}

	 return 0;
}


int cmp(const void *p1,const void *p2)
{
	float f1=*((float *)p1);
	float f2=*((float *)p2);
	if(f1>f2)
		return 1;
	else
		return -1;
}

int main()
{
	int i,j,k;
	int n;
    float h,h1[50],h2[50];
	while(scanf("%d",&n)!=EOF)
	{
		char temp[20];
		int cnt0=0,cnt1=0;
		for(i=0;i<n;i++)
		{
			scanf("%s%f",temp,&h);
			if(temp[0]=='m')
				h1[cnt0++]=h;
			else
				h2[cnt1++]=h;
		}
		qsort(h1,cnt0,sizeof(h1[0]),cmp);
		qsort(h2,cnt1,sizeof(h2[0]),cmp);
		for(i=0;i<cnt0;i++)
			printf("%.2f ",h1[i]);
		for(i=cnt1-1;i>0;i--)
			printf("%.2f ",h2[i]);
		printf("%.2f\n",h2[0]);
	}
	return 0;
}


int main(){
	int n;
	int i,j;
	float g[40],m[40],f[40],r[40];
	float temp;
	int summ=0;
	int sumf=0;
	char sex[40][10];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%f",sex[i],&g[i]);
	}
	for(i=0;i<n;i++){
		if(sex[i][0]=='m'){
			m[summ]=g[i];
			summ=summ+1;
		}
		else{
			f[sumf]=g[i];
			sumf=sumf+1;
		}
	}

	for(i=0;i<summ;i++){
		for(j=0;j<summ;j++){
			if(m[i]<m[j]){
				temp=m[i];
				m[i]=m[j];
				m[j]=temp;
			}
		}
	}
    for(i=0;i<sumf;i++){
		for(j=0;j<sumf;j++){
			if(f[i]>f[j]){
				temp=f[i];
				f[i]=f[j];
				f[j]=temp;
			}
		}
	}
	for(i=0;i<summ;i++)
	printf("%.2f ",m[i]);
	for(i=0;i<sumf;i++)	{
		if(i!=sumf-1)
	printf("%.2f ",f[i]);
		else
printf("%.2f",f[i]);
	}

	return 0;
}


int main()
{
	int n,i,j,k,boys,girls;
	char tmp[10];
	float boy[45],girl[45];
	float shengao,temp;
	scanf("%d",&n);
	getchar();
	for(i=1,j=1,k=1;i<=n;i++)
	{
		scanf("%s",tmp);
		scanf("%f",&shengao);
		if(tmp[0]=='f')
		{
			girl[j]=shengao;
			j++;
		}
		else if(tmp[0]=='m')
		{
			boy[k]=shengao;
			k++;
		}
	}
	boys=k-1;
	girls=j-1;
	for(j=1;j<=boys-1;j++)
	{
		for(i=1;i<=boys-j;i++)
		{
			if(boy[i]>boy[i+1])
			{
				temp=boy[i];
				boy[i]=boy[i+1];
				boy[i+1]=temp;
			}
		}
	}
	for(j=1;j<=girls-1;j++)
	{
		for(i=1;i<=girls-j;i++)
		{
			if(girl[i]<girl[i+1])
			{
				temp=girl[i];
				girl[i]=girl[i+1];
				girl[i+1]=temp;
			}
		}
	}
	for(i=1;i<=boys;i++)
	{
		printf("%.2f ",boy[i]);
	}
	for(i=1;i<=girls;i++)
	{
		if(i==girls)
		{
			printf("%.2f\n",girl[i]);
		}
		else
		{
			printf("%.2f ",girl[i]);
		}
	}
	return 0;
}


int main()
{
int n;
scanf("%d",&n);
double m[40],f[40];
int nm=0,nf=0;
int i;
for (i=0; i<n; i++)
{
char sex[7];
double h;
scanf("%s%lf",sex,&h);
if (sex[0]=='m')
{
nm++;
m[nm-1]=h;
}
else
{
nf++;
f[nf-1]=h;
}
}

int j;
for (i=0; i<nm-1; i++)
for (j=i+1; j<nm; j++)
if (m[i]>m[j])
{
double t=m[i];
m[i]=m[j];
m[j]=t;
}

for (i=0; i<nf-1; i++)
for (j=i+1; j<nf; j++)
if (f[i]<f[j])
{
double t=f[i];
f[i]=f[j];
f[j]=t;
}

for (i=0; i<nm; i++) printf("%.2lf ",m[i]);
for (i=0; i<nf; i++)
{
printf("%.2lf",f[i]);
if (i<nf-1) printf(" "); else printf("\n");
}

return 0;
}


int main()
{
	int n, i, j = 0, k = 0, r, s, u, v;  // n????
	double height, girl_height[40], boy_height[40], temp;
	char gender[6];
	cin >> n;
	for (i = 0; i < n; i++)  // ??????j??????k?????
	{
		cin >> gender >> height;
		if (gender[0] == 'm')
		{
			boy_height[j] = height;
			j++;
		}
		else
		{
			girl_height[k] = height;
			k++;
		}
	}
	for (r = 0; r < j - 1; r++)
	{
		for (u = r + 1; u < j; u++)
		{
			if (boy_height[r] > boy_height[u])
			{
				temp = boy_height[r];
				boy_height[r] = boy_height[u];
				boy_height[u] = temp;
			}
		}
	}
	for (s = 0; s < k - 1; s++)
	{
		for (v = s + 1; v < k; v++)
		{
			if (girl_height[s] < girl_height[v])
			{
				temp = girl_height[s];
				girl_height[s] = girl_height[v];
				girl_height[v] = temp;
			}
		}
	}
	for (r = 0; r < j; r++)
	{
		cout << fixed << setprecision(2)<< boy_height[r] << " ";
	}
	for (r = 0; r < k - 1; r++)
	{
		cout << fixed << setprecision(2) << girl_height[r] << " ";
	}
	cout << girl_height[k - 1];
	return 0;
}


int main(){
    int n,count1=0,count2=0;
	char zf[40][7],q;
    double sg[40];
	scanf("%d%c",&n,&q);
	count2=n-1;
	for(int i=0;i<n;i++){
		scanf("%s",zf[i]);
		int a=strlen(zf[i]);
		if(a==4){
			scanf("%lf",&sg[count1]);
			count1++;
		}else{
			scanf("%lf",&sg[count2]);
			count2--;
		}
	}
	int k,m,d,f;
	double e=0.0,c=0.0;
	for(k=0;k<count1-1;k++){
		for(m=k+1;m<count1;m++){
			if(sg[m]<sg[k]){
				e=sg[k];
				sg[k]=sg[m];
				sg[m]=e;
			}
		}
	}
    for(d=count2+1;d<n;d++){
		for(f=k+1;f<n;f++){
			if(sg[f]<sg[d]){
				c=sg[d];
				sg[d]=sg[f];
				sg[f]=c;
			}
		}
	}
	printf("%.2lf",sg[0]);
	for(int s=1;s<n;s++){
		printf(" %.2lf",sg[s]);
	}
    return 0;
}


double mHeight[40];
double fHeight[40];

int comp(const void *a, const void *b)
{
	//return (int)(*(double *)a -*(double *)b);
	if (*(double *)a > *(double *)b)
		return 1;
	else if (*(double *)a < *(double *)b)
		return -1;
	else
		return 0;
}

int main()
{
	int n;
	int mCount= 0, fCount = 0;
	int i;
	char temp[10];
	double height;
	cin >> n;
	for (i=0; i<n; i++)
	{
		cin >> temp;
		cin >> height;
		if (strcmp(temp, "male") == 0)
		{
			mHeight[mCount++] = height;
		}
		else
			fHeight[fCount++] = height;
	}
	qsort(mHeight, mCount, sizeof(double), comp);
	qsort(fHeight, fCount, sizeof(double), comp);

	for (i=0; i<mCount; i++)
		//cout << setprecision(2) << mHeight[i] << " ";
		printf("%0.2f ", mHeight[i] );
	for (i=0; i<fCount-1; i++)
		//cout << setprecision(2) << fHeight[fCount-1-i] << " ";
		printf("%0.2f ", fHeight[fCount-1-i] );
	//cout << setprecision(2) << fHeight[0] << endl;
	printf("%0.2f\n", fHeight[0]);

	return 0;
}


int main (){
	int count1,count2,all,i,p;
	double height1[40],height2[40],exchange,preheight;
	char input[7];
	scanf("%d",&all);
	count1=0;
	count2=0;
	for(i=0;i<all;i++){
		scanf("%s",input);
		scanf("%lf",&preheight);
		if(strlen(input)==4){height1[count1]=preheight;count1++;}
		if(strlen(input)==6){height2[count2]=preheight;count2++;}
	}
	for(i=0;i<count1;i++){	for(p=0;p<count1-1;p++){if(height1[p]>height1[p+1]){exchange=height1[p];height1[p]=height1[p+1];height1[p+1]=exchange;}}}
	for(i=0;i<count2;i++){	for(p=0;p<count2-1;p++){if(height2[p]<height2[p+1]){exchange=height2[p];height2[p]=height2[p+1];height2[p+1]=exchange;}}}
	printf("%.2lf",height1[0]);
	for(i=1;i<count1;i++){printf(" %.2lf",height1[i]);}
	for(i=0;i<count2;i++){printf(" %.2lf",height2[i]);}

return 0;
}


int cmp(const void *a,const void *b)
{
	int r;
	if((*(float *)a)-(*(float *)b)<0)
		r=-1;
	else if((*(float *)a)-(*(float *)b)==0)
			r=0;
	else r=1;
	return r;
}
int cmp2(const void *a,const void *b)
{
	int r;
	if(*(float *)a-*(float *)b>0)
		r=-1;
	else if(*(float *)a-*(float *)b==0)
			r=0;
		else r=1;
	return r;
}
int main()
{
	int n,i,x=0,y=0;
	float h;
	char temp[10];
	char sex[2][10]={"male","female"};
	float height[2][40];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %f",temp,&h);
		if(strcmp(temp,sex[0])==0){
			height[0][x]=h;
			x++;
		}
		else {
			height[1][y]=h;
			y++;
		}
	}
	qsort(height[0],x,sizeof(float),cmp);
	qsort(height[1],y,sizeof(float),cmp2);
	for(i=0;i<x;i++)
		printf("%.2f ",height[0][i]);
	for(i=0;i<y;i++){
		if(i!=y-1)
			printf("%.2f ",height[1][i]);
		else  printf("%.2f",height[1][i]);
	}
	return 0;
}


struct data{
	char sex[7];
	float h;
}stu[40],m[39],f[39],temp;

int main()
{
	int n,i,j,male,female;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s%f",stu[i].sex,&stu[i].h);
	for(i=male=female=0;i<n;i++)
		if(stu[i].sex[0]=='m'){
			m[male]=stu[i];
			male++;
		}
		else{
			f[female]=stu[i];
			female++;
		}
	for(i=0;i<male-1;i++)
		for(j=0;j<male-1-i;j++)
			if(m[j].h>m[j+1].h){
				temp=m[j+1];
				m[j+1]=m[j];
				m[j]=temp;
			}
	for(i=0;i<female-1;i++)
		for(j=0;j<female-1-i;j++)
			if(f[j].h>f[j+1].h){
				temp=f[j+1];
				f[j+1]=f[j];
				f[j]=temp;
			}
	for(i=0;i<male;i++)
		printf("%.2f ",m[i].h);
	for(i=female-1;i>=1;i--)
		printf("%.2f ",f[i].h);
	printf("%.2f\n",f[i].h);
	return 0;
}


int main()
{
	struct std{
		char sex[7];
		double height;
	}ss[50];
	int n;
	scanf("%d",&n);
	double man[50];
	double wam[50];
	int i,j=0,m=0;
	for(i=0;i<n;i++)
	{
		scanf("%s",ss[i].sex);
		scanf("%lf",&ss[i].height);
		if(strcmp(ss[i].sex,"male")==0)
		{
		    man[j]=ss[i].height;
		    j++;
		}
		if(strcmp(ss[i].sex,"female")==0)
		{
		    wam[m]=ss[i].height;
			m++;
		}
	}
	int k,x;
	double e;
	for(k=1;k<=j;k++)
	{
		for(x=0;x<j-k;x++)
		{
			if(man[x]>man[x+1])
			{
				e=man[x];
				man[x]=man[x+1];
				man[x+1]=e;
			}
		}
	}
	for(k=1;k<=m;k++)
	{
		for(x=0;x<m-k;x++)
		{
			if(wam[x]<wam[x+1])
			{
				e=wam[x];
				wam[x]=wam[x+1];
				wam[x+1]=e;
			}
		}
	}
	int a,b;
	for(a=0;a<j;a++)
	{
		printf("%.2lf ",man[a]);
	}
	for(b=0;b<m;b++)
	{
		if(b!=m-1)
		{
			printf("%.2lf ",wam[b]);
		}
		else{
			printf("%.2lf",wam[b]);
		}
	}
	return 0;
}


int main()
{
	int n;
	int i,j;
	double tmph;
	int count=0;
	char tmp[10];
	int state=0;
	struct info
	{
		char sex[10];
		double h;
	}
	stu[50];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %lf",stu[i].sex,&stu[i].h);
		if (strcmp(stu[i].sex,"male")==0)
		{
			count++;
		}
	}
	for (i=0;i<n;i++)
	{
		for (j=i;j<n;j++)
		{
			if (strcmp(stu[i].sex,stu[j].sex)<0)
			{
				strcpy(tmp,stu[i].sex);
				strcpy(stu[i].sex,stu[j].sex);
				strcpy(stu[j].sex,tmp);
				tmph=stu[i].h;
				stu[i].h=stu[j].h;
				stu[j].h=tmph;
			}
		}
	}
	for (i=0;i<count;i++)
	{
		for (j=0;j<count;j++)
		{
			if (stu[i].h<stu[j].h)
			{
				tmph=stu[i].h;
				stu[i].h=stu[j].h;
				stu[j].h=tmph;
			}
		}
	}
	for (i=count;i<n;i++)
	{
		for (j=count;j<n;j++)
		{
			if (stu[i].h>stu[j].h)
			{
				tmph=stu[i].h;
				stu[i].h=stu[j].h;
				stu[j].h=tmph;
			}
		}
	}
	for (i=0;i<n;i++)
	{
		if (state)
		{
			printf(" %.2lf",stu[i].h);
		}
		else
		{
			printf("%.2lf",stu[i].h);
			state=1;
		}
	}
	return 0;
}


int cmp( const void *a , const void *b )
{
return (*(float *)a) > (*(float *)b) ? 1 : -1;
}
main()
{
      int n,b=0,g=0;
      scanf("%d",&n);
      int i;
      char sex[8];
      float B[n],G[n];
      for(i=0;i<n;i++)
      {
                      scanf("%s",sex);
                      if(sex[0]=='m'){
                         scanf("%f",&B[b]);
                         b++;
                         }
                      else{
                        scanf("%f",&G[g]);
                        g++;}

      }
      qsort(B,b,sizeof(B[0]),cmp);
      qsort(G,g,sizeof(B[0]),cmp);
      for(i=0;i<b;i++)
      {
                      printf("%.2f ",B[i]);
                      }
      for(i=g-1;i>0;i--)
      {
                      printf("%.2f ",G[i]);}
      printf("%.2f\n",G[i]);
      }


int main()
{
	int N, k,i, j;
	char sex[10];
	double a[45], b[45], temp;
	int boy = 0, girl = 0;
	cin >> N;
	for (k = 0; k < N; k++)
	{
		cin >> sex >> temp;
		if (sex[0] == 'f' )
		{
			b[girl] = temp;
			girl++;
		}
		else
		{
			a[boy] = temp;
			boy++;
		}
	}
	for(i = 0; i < boy - 1;i++)
		for(j = 0; j < boy - 1 - i;j++)
		{
			if (a[j] > a[j + 1])
			{
				temp = a[j + 1];
				a[j + 1] = a[j];
				a[j] = temp;
			}
		}
    for(i = 0; i < girl - 1;i++)
		for(j = 0; j < girl - 1 - i;j++)
		{
			if (b[j] < b[j + 1])
			{
				temp = b[j + 1];
				b[j + 1] = b[j];
				b[j] = temp;
			}
		}
	for(i = 0; i < boy;i++)
		cout <<fixed << setprecision(2) <<  a[i] << " ";
    for(j = 0; j < girl - 1;j++)
	    cout <<fixed << setprecision(2) << b[j] << " ";
	cout <<fixed << setprecision(2)<< b[j] << endl;
	return 0;
}


int Compare1(const void*elem1,const void*elem2)
{
    int*p1,*p2;
    p1=(int*)elem1;
     p2=(int*)elem2;
    return(*p1)-(*p2);
}
int Compare2(const void*elem1,const void*elem2)
{
    int*p1,*p2;
    p1=(int*)elem1;
     p2=(int*)elem2;
    return(*p2)-(*p1);
}
main()
{
int n;
scanf("%d",&n);
int i,p,q;
p=q=0;
float m[n],f[n];
for(i=0;i<n;i++)
{
char sex[7];
scanf("%s",sex);
if(sex[0]=='m')
{
scanf("%f",&m[p]);
p++;
}
if(sex[0]=='f')
{
scanf("%f",&f[q]);
q++;
}
}
qsort(m,p,sizeof(float),Compare1);
for(i=0;i<p;i++)
printf("%.2f ",m[i]);
qsort(f,q,sizeof(float),Compare2);
for(i=0;i<q;i++)
{
    if(i==q-1)
printf("%.2f",f[i]);
else
printf("%.2f ",f[i]);
}
}


int main()
{
	int num,countm = 0,countf = 0;
	float m[40],f[40];
	float t;
	char temp[10];
	cin>>num;
	for(int i = 0;i<num;i++)
	{
		cin>>temp;
		cin>>t;
		if(temp[0] == 'm')
		{
			m[countm] = t;
			countm++;
		}
		else
		{
			f[countf] = t;
			countf++;
		}
	}
	sort(m,m+countm);
	sort(f,f+countf);

	for(int i = 0;i<countm;i++)
	{
		printf("%.2f ",m[i]);
	}
	for(int i = countf-1;i>=0;i--)
	{
		printf("%.2f",f[i]);
		if(i != 0)
			cout<<' ';
	}
	return 0;
}


float man[40];
float woman[40];

int n;

int compare1(const void * a, const void *b)
{
	float * p = (float *)a;
	float * q = (float *)b;

	if(*p > *q)
		return 1;
	else
		return 0;
}

int compare2(const void * a, const void *b)
{
	float * p = (float *)a;
	float * q = (float *)b;

	if(*p > *q)
		return 0;
	else
		return 1;
}

int main()
{
	int i = 0, j =0, k = 0, x = 0, y = 0;
	char sex[10];
	float height;

	scanf("%d", &n);
	for(i = 0; i < n; ++i)
	{
		scanf("%s", sex);
		scanf("%f", &height);
		if(strcmp(sex, "female") == 0)
		{
			woman[j] = height;
			j += 1;
		}
		else
		{
			man[k] = height;
			k += 1;
		}
	}

	qsort(man, k, sizeof(float), compare1);
	qsort(woman, j, sizeof(float), compare2);

	for(i = 0; i < k; ++i)
	{
		printf("%.2f ", man[i]);
	}
	for(i = 0; i < j - 1; ++i)
	{
		printf("%.2f ", woman[i]);
	}
	printf("%.2f\n",woman[i]);
	return 0;
}


main()
{
    int i,n,j,p=0,q=0;
    float d;
    struct photo
    {
        char gender[10];
        float height;
    }a[40],m[40],f[40];

    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%s %f",&a[i].gender,&a[i].height);

    for(i=0;i<n;i++)
    {
        if (a[i].gender[0]=='m')
        {
            m[p]=a[i];
            p++;
        }
        else
        {
            f[q]=a[i];
            q++;
        }
    }

    for(i=0;i<p-1;i++)
    {
        for(j=i;j<p;j++)
        {
            if(m[i].height>m[j].height)
            {
                d=m[i].height;
                m[i].height=m[j].height;
                m[j].height=d;
            }
        }
    }
    for(i=0;i<q-1;i++)
    {
        for(j=i;j<q;j++)
        {
            if(f[i].height<f[j].height)
            {
                d=f[i].height;
                f[i].height=f[j].height;
                f[j].height=d;
            }
        }
    }

    for(i=0;i<p;i++)
    printf("%4.2f ",m[i].height);
    for(i=0;i<q-1;i++)
    printf("%4.2f ",f[i].height);
    printf("%4.2f",f[q-1].height);

}


struct stu
{
char gen[7];
float hei;
};

int main()
{

struct stu stu[40],t; //shifouyaogaichengdongtai?
int n,i,j,s=0;

scanf("%d",&n);
for(i=0;i<n;i++)
                {
                        scanf("%s %f",stu[i].gen,&stu[i].hei);
               }

for(j=0;j<n;j++)
for(i=0;i<n-1-j;i++)
{
   if(stu[i].hei>stu[i+1].hei)
    {t=stu[i];
     stu[i]=stu[i+1];
     stu[i+1]=t;}
}

for(i=0;i<n;i++)
{
               if(strlen(stu[i].gen)==4)
              //  if(*(stu[i]).gen=='male')
              {
                  if(s==0)
              {printf("%.2f",stu[i].hei);s++;}
              else{printf(" %.2f",stu[i].hei);}
              }
}

for(i=n-1;i>=0;i--)
{
    if(strlen(stu[i].gen)!=4)
  //if(*(stu[i]).gen!='male')
  printf(" %.2f",stu[i].hei);
}

return 0;
}
//zifuchuanbijiaoyaoyonghanshu


int main()
{
	int n, n_m, n_f, i, j;
	float male[40], female[40];
	char s[10];
	float t;
	scanf("%d", &n);
	n_m = 0;
	n_f = 0;
	for(i = 1; i <= n; i++)
	{
		scanf("%s", s);
		if(s[0] == 'm')
		{
			scanf("%f", &male[n_m]);
			n_m++;
		}
		else
		{
			scanf("%f", &female[n_f]);
			n_f++;
		}
	}
	for(i = 0; i < n_m - 1; i++)
		for(j = i + 1; j <= n_m - 1; j++)
		{
			if(male[i] > male[j])
			{
				t = male[i];
				male[i] = male[j];
				male[j] = t;
			}
		}
	for(i = 0; i < n_f - 1; i++)
		for(j = i + 1; j <= n_f - 1; j++)
		{
			if(female[i] < female[j])
			{
				t = female[i];
				female[i] = female[j];
				female[j] = t;
			}
		}
	for(i = 0; i <= n_m - 1; i++)
		printf("%.2f ", male[i]);
	for(i = 0; i < n_f - 1; i++)
		printf("%.2f ", female[i]);
	printf("%.2f\n", female[n_f - 1]);
	return 0;
}


int main(){
	int num;
	scanf("%d",&num);
	int i;
	int f=0,m=0;
	char c[7];
	double high;
	double mh[40],nh[40];
	for(i=0;i<num;i++){
	scanf("%s %lf",c,&high);
	if(strcmp(c,"male")==0){
	m=m+1;
	mh[m-1]=high;
	}else{
	f=f+1;
	nh[f-1]=high;
	}
	}
	int j;
	double max;
	for(i=1;i<=m;i++){
		for(j=0;j<m-i;j++){
			if(mh[j]>mh[j+1]){
			max=mh[j];
			mh[j]=mh[j+1];
			mh[j+1]=max;
			}
		}}
	for(i=1;i<=f;i++){
		for(j=0;j<f-i;j++){
			if(nh[j]<nh[j+1]){
			max=nh[j];
			nh[j]=nh[j+1];
			nh[j+1]=max;
			}
		}}
	for(i=0;i<m;i++){
	printf("%.2lf ",mh[i]);
	}
	printf("%.2lf",nh[0]);
	for(i=1;i<f;i++){
	printf(" %.2lf",nh[i]);
	}

return 0;
}


/*Macro*/
float male[N];
float female[N];

int main(int argc, char *argv[])
{
/*Definition*/

	int i = 0;
	int j = 0;
	int n = 0;
	char p[10] = "H";
	float h = 0;
	int ii = 0;
	int jj = 0;
/*Definition*/
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	scanf("%d", &n);
	while(n--)
	{
		scanf("%s%f", p, &h);
		if(0 == strcmp(p, "male"))
		{
			male[i++] = h;
		}
		else
		{
			female[j++] = h;
		}
	}

	for(ii= 0; ii < i; ii++)
	{
		for(jj=ii+1; jj < i; jj++)
		{
			if(male[ii] > male[jj])
			{
				h = male[ii];
				male[ii] = male[jj];
				male[jj] = h;
			}
		}
	}

	for(ii= 0; ii < j; ii++)
	{
		for(jj=ii+1; jj < j; jj++)
		{
			if(female[ii] < female[jj])
			{
				h = female[ii];
				female[ii] = female[jj];
				female[jj] = h;
			}
		}
	}

	for(ii=0; ii < i; ii++)
	{
		printf("%.2lf ", male[ii]);
	}
	for(jj=0; jj <j-1; jj++)
	{
		printf("%.2lf ", female[jj]);
	}
	printf("%.2lf\n", female[jj]);

	return 0;
}


int main(){
	int n,i,j,h;
	j=1;
	h=1;
	scanf("%d",&n);
	double hei[50],man[50],woman[50];
	char xb[50][10];
	int chang[50];
	for(i=1;i<=n;i++){
		scanf("%s %lf\n",xb[i],&hei[i]);
		chang[i]=strlen(xb[i]);
		if(chang[i]==4){
			man[j]=hei[i];
			j++;
		}
		if(chang[i]==6){
			woman[h]=hei[i];
			h++;
		}
	}
	j--;
	h--;
	int k;
	double e;
	for(k=1;k<j;k++){
		for(i=1;i<=j-k;i++){
			if(man[i]>man[i+1]){
				e=man[i+1];
				man[i+1]=man[i];
				man[i]=e;
			}
		}
	}
	for(k=1;k<h;k++){
		for(i=1;i<=h-k;i++){
			if(woman[i]<woman[i+1]){
				e=woman[i+1];
				woman[i+1]=woman[i];
				woman[i]=e;
			}
		}
	}
	for(i=1;i<=j;i++)
		printf("%.2lf ",man[i]);
	printf("%.2lf",woman[1]);
	for(i=2;i<=h;i++)
		printf(" %.2lf",woman[i]);
	return 0;
}