semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	struct
	{
		char a[12];
		double b;
	}
	q[50];
	char e[50];
	double d[50],k;
	int i,j,l,n;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s %lf",q[i].a,&q[i].b);
	}
	for(i=0;i<=n-1;i++)
	{
		for(j=0;j<=n-2-i;j++)
		{
			if(q[j].b>q[j+1].b)
			{
				k=q[j].b;
				q[j].b=q[j+1].b;
				q[j+1].b=k;
				strcpy(e,q[j].a);
				strcpy(q[j].a,q[j+1].a);
				strcpy(q[j+1].a,e);
			}
		}
	}

	for(i=0;i<=n-1;i++)
	{
		if(q[i].a[0]=='m')
		{
			printf("%.2lf ",q[i].b);
			
		}
	}
	l=0;
	for(i=n-1;i>=0;i--)
	{
		if(q[i].a[0]=='f')
		{
			d[l]=q[i].b;
			l++;
		}
	}
	for(i=0;i<=l-2;i++)
		printf("%.2lf ",d[i]);
	printf("%.2lf",d[l-1]);
	return 0;
}
/*************************************************************************************************************
* @file .cpp
* @author ????
* @date 11.01
* @description
*         
*/


int main()
{
	int j = 0, k = 0, i, m, n, l;
	char gender[7];
	float temp;
	float female[40];
	float male[40];
	cin >> n;
	cin.get();
	for(i = 0; i < n; i++)
	{
		cin >> gender;
		if (strlen(gender) == 6)
		{
			cin >> female[j];
			j++;
		}
		if (strlen(gender) == 4)
		{
			cin >> male[k];
			k++;
		}
	}
	for(m = 0; m < k; m++)
	{
		for(l = m + 1; l < k; l++)
		{
			if (male[m] > male[l])
			{
				temp = male[m];
				male[m] = male[l];
				male[l] = temp;
			}
		}
	}
	for(m = 0; m < j; m++)
	{
		for(l = m + 1; l < j; l++)
		{
			if (female[m] < female[l])
			{
				temp = female[m];
				female[m] = female[l];
				female[l] = temp;
			}
		}
	}
	printf("%.2f",male[0]);	
	for (i = 1; i < k; i++)
	{
		cout <<" ";
		printf("%.2f",male[i]);
	}
	for (i = 0; i < j; i++)
	{
		cout <<" ";
		printf("%.2f",female[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()
{
	char sex[1000];
	double m[10000],f[10000],temp;
	int i,j,k,n,xm=0,xf=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",&sex,&temp);
		if(sex[0]=='m')
		{
			m[xm]=temp;
			xm++;
		}
		if(sex[0]=='f')
		{
			f[xf]=temp;
			xf++;
		}

	}
	for(i=0;i<xm;i++)	for(j=0;j<xm-1;j++)
	{
		if(m[j]>m[j+1])
		{
			temp=m[j];
			m[j]=m[j+1];
			m[j+1]=temp;
		}
	}
	for(i=0;i<xf;i++)	for(j=0;j<xf-1;j++)
	{
		if(f[j]<f[j+1])
		{
			temp=f[j];
			f[j]=f[j+1];
			f[j+1]=temp;
		}
	}
	for(i=0;i<xm;i++)	printf("%.2lf ",m[i]);
	for(i=0;i<xf-1;i++)	printf("%.2lf ",f[i]);
	printf("%.2lf\n",f[xf-1]);
	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;
}
main()
{
    int n,m,i,j,k;
    double a[50],c[50],p;
    char s[80];
    scanf("%d",&n);
    m=0;
    k=0;
    for(i=0;i<n;i++)
       {
         scanf("%s",&s);
         if(s[0]=='m')
           {
            scanf("%lf",&a[m]);          
            m++;
            }
         if(s[0]=='f')
           {
            scanf("%lf",&c[k]);
            k++;
            }
         }  
    for(i=0;i<m-1;i++)
       for(j=i+1;j<m;j++)
           if(a[i]>a[j])
           {
              p=a[i];
              a[i]=a[j];
              a[j]=p;
              }
    for(i=0;i<k-1;i++)
       for(j=i+1;j<k;j++)
          if(c[i]<c[j])
          {
             p=c[i];
             c[i]=c[j];
             c[j]=p;
             }         
    printf("%.2lf",a[0]);
    for(i=1;i<m;i++) printf(" %.2lf",a[i]);
    for(j=0;j<k;j++) printf(" %.2lf",c[j]);
    printf("\n");
    //getchar();
    //getchar();
    }
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 a[10000];
char b[10000][100];
double m[10000],f[10000];
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	int p=0,q=0;
	for(i=0;i<n;i++)
	{
		scanf("%s",b[i]);
	//	scanf("%lf",&c[i]);
		if(b[i][0]=='m')
		{
			scanf("%lf",&m[p]);
			p++;
		}
		else
		{
			scanf("%lf",&f[q]);
			q++;
		}
	}
	int x,y;
	int k;
	double e;
	for(k=0;k<=p;k++)
	{
		for(x=0;x<p-1;x++)
		{
		if(m[x]>m[x+1])
		{
			e=m[x];
			m[x]=m[x+1];
			m[x+1]=e;
		}
		}
	}
	for(k=0;k<=q;k++)
	{
		for(y=0;y<q-1;y++)
		{
		if(f[y]<f[y+1])
		{
			e=f[y];
			f[y]=f[y+1];
			f[y+1]=e;
		}
		}
	}
	printf("%.2lf",m[0]);
	for(x=1;x<p;x++)
		{
	
	printf(" %.2lf",m[x]);
	}
	for(y=0;y<q;y++ )
		{
	
	printf(" %.2lf",f[y]);
	}
	return 0;
}
int main()
{
    char a[7];
    int n,i,j,p,q;
    p=0;q=0;
    scanf("%d",&n);
    float m[50],f[50],g;
    for(i=0;i<n;i++)
    {
        scanf("%s",a);
        if(a[0]=='m')
        {
            scanf("%f",&m[p]);
            p=p+1;
        }
        else
        {
            scanf("%f",&f[q]);
            q=q+1;
        }
    }
    for(i=0;i<p-1;i++)
    {
        for(j=i+1;j<p;j++)
        {
            if(m[i]>m[j])
            {
                g=m[i];
                m[i]=m[j];
                m[j]=g;
            }
        }
    }
    for(i=0;i<p;i++)
    printf("%0.2f ",m[i]);
    for(i=0;i<q-1;i++)
    {
        for(j=i+1;j<q;j++)
        {
            if(f[i]<f[j])
            {
                g=f[i];
                f[i]=f[j];
                f[j]=g;
            }
        }
    }
    for(i=0;i<q-1;i++)
    printf("%0.2f ",f[i]);
    printf("%0.2f",f[q-1]);
    return 0;
}
int main()
{
    int i,j,m,l,p,q,k,a1,b1;
    double n;
    char s[1000];
      scanf("%d",&m); 
    double a[100],b[100];
    memset(b,0,sizeof(b));
    memset(a,0,sizeof(a));
    l=0;
    a1=0;b1=0;
    for (i=1;i<=m;i++)
    {
        scanf("%s %lf",s,&n);
       
     if (s[0]=='m') 
     { 
       p=0;
       for (j=1;j<=a1;j++)
       if (n<a[j]) 
       {
        for (k=a1;k>=j;k--)
       a[k+1]=a[k];  
       a[j]=n;
       p=1;           
       break;
       }
          a1++;
      if (p==0)
      {
        
           a[a1]=n;
       }
       
       }
     else 
     {
       p=0;
       for (j=1;j<=b1;j++)
       if (n>b[j]) 
       {
        for (k=b1;k>=j;k--)
       b[k+1]=b[k];  
       b[j]=n;
       p=1;           
       break;
       }
       b1++;
      if (p==0)
      {
           
           b[b1]=n;
       }
       
     }      
     }                
     for(i=1;i<=a1;i++) printf("%.2lf ",a[i]);
     for (i=1;i<=b1-1;i++) printf("%.2lf ",b[i]);
     printf("%.2lf",b[b1]);

    return 0;
}
main()
{
  int n,i,t1=0,t2=0,j;
  float m[40]={0},f[40]={0},l;int s[40]={0};char h[6]={'\0'};
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
     scanf("%s %f",h,&l);
     if(h[0]=='f') {f[t1]=l;t1++;}
     else {m[t2]=l;t2++;}
  }
  for(i=0;i<t2-1;i++)
  {
    for(j=i;j>=0;j--)
    {
       if(m[j]>m[j+1]) {float t=m[j];m[j]=m[j+1];m[j+1]=t;}
    }
  }
  for(i=0;i<t1-1;i++)
  {
    for(j=i;j>=0;j--)
    {
       if(f[j]<f[j+1]) {float t=f[j];f[j]=f[j+1];f[j+1]=t;}
    }
  }
  for(i=0;i<t2;i++) printf("%.2f ",m[i]);
  for(i=0;i<t1;i++) {if(i!=t1-1)printf("%.2f ",f[i]); else printf("%.2f",f[i]);}
  getchar();
  getchar();
  getchar();
}
int main()
{
	int i,n,j=0,k=0,m;
    double b[40],c[40],zh,d[40];
	char a[40][7];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",&a[i],&b[i]);
		if(a[i][0]==109)
		{   
			c[j]=b[i];
			j++;
		}
		else
		{
			d[k]=b[i];
		    k++;
		}
	}
	for(m=1;m<j;m++)
	{
		for(i=0;i<j-m;i++)
		if(c[i]>c[i+1])
		{
			zh=c[i];
			c[i]=c[i+1];
			c[i+1]=zh;
		}
	}
	for(m=1;m<k;m++)
	{
		for(i=0;i<k-m;i++)
		if(d[i]<d[i+1])
		{
			zh=d[i];
			d[i]=d[i+1];
			d[i+1]=zh;
		}
	}
	for(i=0;i<j;i++)
	{
		if(i==0)
		printf("%.2lf",c[i]);
		else printf(" %.2lf",c[i]);
	}
	for(i=0;i<k;i++)
		printf(" %.2lf",d[i]);
		return 0;
}
int main()
{
	//?????????????????????????????//??????????????????????????????????????
	//int n,i,x=0,y=0,k,t;
	//char a[100];
	//int b[100],c[100],d[100];                   ///???????????????,?????????double??
	//scanf("%d",&n);
	int n,i,m,j=0,k=0;
	scanf("%d",&n);
	double male[50],female[50],daiding[100],tmp;   //daiding[100]???????d[100]?b c????male && female
	char xingbie[10];



	for(i=0;i<n;i++)
	{
		scanf("%s",xingbie);
		scanf("%lf",&daiding[i]);                 //?????????????????????????????????????????
		
		
		
		
		
		
		
		if(xingbie[0]=='m')                      //?????xingbie[0],??xingbie[1],????????a[1];
		{
			male[j]=daiding[i];
			j++;                        //j==??x
		}
		else if(xingbie[0]=='f')
		{
			female[k]=daiding[i];
			k++;                        //k==??y
		}
	}





	//?????????????








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

		}
	}





	//???????????????????????????????????????m<j-1???m<j;??male[m+1]??????????
	for(i=0;i<k;i++)
	{
		for(m=0;m<k-1;m++)
		{
			if(female[m]>female[m+1])
			{
				tmp=female[m];
				female[m]=female[m+1];
				female[m+1]=tmp;
			}
		}
	}


	//?????????????????????????????????????????????????????????













	for(i=0;i<j;i++)
		printf("%.2lf ",male[i]);
	for(i=k-1;i>0;i--)
		printf("%.2lf ",female[i]);


	//???????????????????????????????
	printf("%.2lf",female[0]);

	//???????????



	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 main(){
	int i,n,j=0,l=0,k;
	float h,x[100],y[100],e;
	char a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",a);
		scanf("%f",&h);
		if(a[0]=='m'){
			x[j]=h;
			j++;}
		else{
			y[l]=h;
			l++;
		}
	}
	for(k=1;k<j;k++){
		for(i=0;i<j-k;i++){
			if(x[i]>x[i+1]){
				e=x[i+1];
				x[i+1]=x[i];
				x[i]=e;
			}
		}
	}
	for(k=1;k<l;k++){
		for(i=0;i<l-k;i++){
			if(y[i]>y[i+1]){
				e=y[i+1];
				y[i+1]=y[i];
				y[i]=e;
			}
		}
	}
	printf("%.2f",x[0]);
	for(i=1;i<j;i++){
		printf(" %.2f",x[i]);
	}
	for(i=l-1;i>=0;i--){
		printf(" %.2f",y[i]);
	}
	return 0;
}
//2013.11.17
//zwb

int main ()
{
	int n, i, j, k, flag = 0;
	float t;
	float hm[41] = {0}, hf[41] = {0};
	char sex[7];

	cin >> n;
	
	for(i = 1; i <= n; i++)
	{
		cin >> sex;
		if(sex[0] == 'm')
			cin >> hm[i];
		if(sex[0] == 'f')
			cin >> hf[i];
	}
	
	for(j = 1; j <= 40; j++)
	{
		for(k = 1; k <= 40; k++)
		{
			if(hm[k] > hm[k+1])
			{
				t = hm[k];
				hm[k] = hm[k+1];
				hm[k+1] = t;
			}
		}
	}

	for(j = 0; j < 40; j++)
	{
		for(k = 0; k < 40 - j; k++)
		{
			if(hf[k] < hf[k+1])
			{
				t = hf[k];
				hf[k] = hf[k+1];
				hf[k+1] = t;
			}
		}
	}

	for(j = 0; j <= 40; j++)
	{
		if(hm[j] != 0 && flag != 0)
		{
			cout << fixed;
			cout << setprecision(2) << " " << hm[j];
		}
		if(hm[j] != 0 && flag == 0)
		{
			flag = 1;
			cout << fixed;
			cout << setprecision(2) << hm[j];
		}
	}

	for(j = 0; j <= 40; j++)
	{
		if(hf[j] != 0)
		{
			cout << fixed;
			cout << setprecision(2) << " " << hf[j];
		}
	}

	cout << endl;

	return 0;
}
main()
{
      int n,i,j=0,k=0,m;
      float a[40],d;
      char c[40][7],b[7];
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
                      scanf("%s",c[i]);
                      if(strcmp(c[i],"male")==0)
                      j++;
                      scanf("%f",&a[i]);
                      }
      for(i=0;i<n;i++)
      {
                      if(strcmp(c[i],"male")==0)
                      {
                                      strcpy(b,c[i]);
                                      strcpy(c[i],c[k]);
                                      strcpy(c[k],b);
                                      d=a[i];
                                      a[i]=a[k];
                                      a[k]=d;
                                      k++;
                                      }
                                      }
      for(i=0;i<j-1;i++)
      {
                        for(m=0;m<j-i-1;m++)
                        {
                                            if(a[m]>a[m+1])
                                            {
                                                           d=a[m+1];
                                                           a[m+1]=a[m];
                                                           a[m]=d;
                                                           }
                                                           }
                                                           }
      for(i=j;i<n-1;i++)
      {
                        for(m=j;m<n-i+j-1;m++)
                        {
                                              if(a[m]<a[m+1])
                                              {
                                                             d=a[m+1];
                                                             a[m+1]=a[m];
                                                             a[m]=d;
                                                             }
                                                             }
                                                             }
      printf("%.2f",a[0]);
      for(i=1;i<n;i++)
      printf(" %.2f",a[i]);

      }
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 n,i,j,k,nan,nv;
	scanf("%d\n",&n);
	char a[42][8];
	double b[42],c[42],d[42],x;
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",a[i],&b[i]);
	}
	j=0;
	k=0;
	for(i=0;i<n;i++)
	{
		if(a[i][0]=='m')
		{
			c[j]=b[i];
			j++;
		}
		else
		{
			d[k]=b[i];
			k++;
		}
	}
	nan=j;
	nv=k;
	for(i=0;i<nan;i++)
	{
		for(j=i;j<nan;j++)
		{
			if(c[j]<c[i])
			{
				x=c[j];
				c[j]=c[i];
				c[i]=x;
			}
		}
	}
	for(i=0;i<nv;i++)
	{
		for(j=i;j<nv;j++)
		{
			if(d[j]>d[i])
			{
				x=d[j];
				d[j]=d[i];
				d[i]=x;
			}
		}
	}
	for(i=0;i<nan;i++)
	{
		printf("%.2lf ",c[i]);
	}
	printf("%.2lf",d[0]);
	for(i=1;i<nv;i++)
	{
		printf(" %.2lf",d[i]);
	}
	return 0;
}
int main()
{
	int n,i,a=0,b=0,j;
	char s[20];
	double m[1000],w[1000],t=1.50,z;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",s,&t);
		if(s[0]=='m'){
			m[a]=t;
			a++;
		}else if(s[0]=='f'){
			w[b]=t;
			b++;
		}
	}



	for(i=1;i<a;i++){
		for(j=0;j<a;j++){
			if(m[j]<m[j+1]){
				z=m[j];
				m[j]=m[j+1];
				m[j+1]=z;
			}
		}
	}

	for(i=1;i<b;i++){
		for(j=0;j<b;j++){
			if(w[j]<w[j+1]){
				z=w[j];
				w[j]=w[j+1];
				w[j+1]=z;
			}
		}
	}


	for(i=a-1;i>=0;i--){
		printf("%.2lf ",m[i]);
	}


	for(i=0;i<b;i++){
		if(i<b-1){
			printf("%.2lf ",w[i]);
		}else if(i==b-1){
			printf("%.2lf",w[i]);	
		}
	}

	return 0;
}
int main()
{

     int a,i,j=0,k=0,l;
     scanf("%d",&a);
     char b[40][6];
     float c[40];
     float m[40];
     float f[40];
     float temp;
     for(i=0;i<40;i++)
     {
       f[i]=0;
       m[i]=0;
     }
     for(i=0;i<a;i++)
       {scanf("%s",b[i]);
        scanf("%f",&c[i]);}  

     for(i=0;i<a;i++)
     {
       if(b[i][0]=='m')
       {m[j]=c[i];
       j++;}
       else
       if(b[i][0]='f')
       {f[k]=c[i];
       k++;}
     } 
     for(j=0;j<a;j++)
     if(m[j]==0)
     break;
     for(i=0;i<j-1;i++)
     {for(l=i+1;l<j;l++)
     
 
     if(m[l]<m[i])
     {temp=m[i];
     m[i]=m[l];
     m[l]=temp;}}

     for(k=0;k<a;k++)
     if(f[k]==0)
     break;
     for(i=0;i<k-1;i++)
     
     
     for(l=i+1;l<k;l++)
     
     
     if(f[l]>f[i])
     {temp=f[i];
     f[i]=f[l];
     f[l]=temp;}


     for(i=0;i<j;i++)
     
     printf("%.2f ",m[i]);
     for(i=0;i<k-1;i++)
     printf("%.2f ",f[i]);
     printf("%.2f\n",f[i]); 
    return 0;
}
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;
}
//********************************
//*??????   **
//*?????? 1300012713 **
//*???2014.1.3  **
//********************************
int main()
{
	int i,j,n,a0 = 0,b0 = 0;
	double a[40],b[40];
	char str[10];
	cin >> n;
	for(i = 1; i <= n; i++)
	{
		cin >> str;
		if(strcmp(str,"male")==0)
		{
			a0++;
			cin >> a[a0];
		}
		else
		{
			b0++;
			cin >> b[b0];
		}
	}
	for(j = 1; j <= a0;j++)
	{
		for(i = 1; i <= a0-j;i++)
		{
			if(a[i] > a[i+1])
			{
				double a1 = a[i];
			    a[i] = a[i+1];
			    a[i+1] = a1;
			}
		}
	}	
	for(j = 1; j <= b0;j++)
	{
		for(i = 1;i<=b0-1;i++)
		{
		    if(b[i]<b[i+1])
			{
			    double b1 = b[i];
			    b[i] = b[i+1];
			    b[i+1] = b1;
			}
		}
	}
	for(i =1;i<=a0;i++)
		printf("%.2f ",a[i]);
	for(i=1;i<=b0-1;i++)
		printf("%.2f ",b[i]);
	printf("%.2f",b[b0]);
	return 0;
}
int main()
{
	int n,i,k;
	char zfc[100][20],es[20];
	double h[100],eh;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",zfc[i],&h[i]);
	}
    for(k=1;k<n;k++)
	{
		for(i=0;i<n-k;i++)
		{
            if((strcmp(zfc[i],"female")==0&&strcmp(zfc[i+1],"male")==0)||(strcmp(zfc[i],"male")==0&&strcmp(zfc[i+1],"male")==0&&h[i]>h[i+1])||(strcmp(zfc[i],"female")==0&&strcmp(zfc[i+1],"female")==0&&h[i]<h[i+1]))
			{
				strcpy(es,zfc[i]);
				strcpy(zfc[i],zfc[i+1]);
				strcpy(zfc[i+1],es);
				eh=h[i];
				h[i]=h[i+1];
				h[i+1]=eh;
			}
		}
	}
	printf("%.2lf",h[0]);
	for(i=1;i<n;i++)
	{
		printf(" %.2lf",h[i]);
	}
	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;
}
int main()
{
    int n;
	scanf("%d",&n);
	char ren[50][10];
	double h[50];
	int i;
	char boy[50][10];
	char girl[50][10];
	double hb[50];
	double hg[50];
	int k1=0,k2=0;
	for(i=0;i<n;i++)
	{
		scanf("%s",ren[i]);
		scanf("%lf",&h[i]);
		
		if(strlen(ren[i])==4)
		{
			strcpy(boy[k1],ren[i]);
			hb[k1]=h[i];
			k1++;

		}
		else
		{
			strcpy(girl[k2],ren[i]);
			hg[k2]=h[i];
			k2++;
		}
	}
	int k;
	for(k=1;k<=k1;k++)
	{
		for(i=0;i<k1-k;i++)
		{
			if(hb[i]>hb[i+1])
			{
				double e;
				e=hb[i];
				hb[i]=hb[i+1];
				hb[i+1]=e;
			}
		}

	}
	for(i=0;i<k1;i++)
	{
		if(i!=0)
		{
			printf(" ");
		}
		printf("%.2lf",hb[i]);

	}
		for(k=1;k<=k2;k++)
	{
		for(i=0;i<k2-k;i++)
		{
			if(hg[i]>hg[i+1])
			{
				double e;
				e=hg[i];
				hg[i]=hg[i+1];
				hg[i+1]=e;
			}
		}

	}
	for(i=k2-1;i>=0;i--)
	{
		
		printf(" ");
		printf("%.2lf",hg[i]);

	}
	
	return 0;

}
int main()
{
	int n,i,j,t,h;
	double sz[50],a[50],b[50],c[50],k;
    char s[10];
	scanf("%d",&n);
	t=h=0;
	for(i=0;i<n;i++){
		scanf("%s %lf",s,&sz[i]);
     	if(strcmp(s,"male")==0){
	    	a[t]=sz[i];
            t++;
		}
		else{
			b[h]=sz[i];
			h++;
		}
	}
	for(j=0;j<t;j++){
		for(i=0;i<t-1;i++){
			if(a[i+1]<a[i]){
				k=a[i+1];
				a[i+1]=a[i];
				a[i]=k;
			}
		}
	}
	for(j=0;j<h;j++){
		for(i=0;i<h-1;i++){
			if(b[i+1]>b[i]){
				k=b[i+1];
				b[i+1]=b[i];
				b[i]=k;
			}
		}
	}
	for(i=0;i<t;i++){
		c[i]=a[i];
	}
	for(i=0;i<h;i++){
		c[i+t]=b[i];
	}
	for(i=0;i<t+h-1;i++){
		printf("%.2lf ",c[i]);
	}
	printf("%.2lf",c[t+h-1]);
	return 0;
}