Problem E: 12306
#include <stdio.h> struct student{ int n; int m;}; int main(void) { int T; int k,g,i,j; struct student s1[50],max; scanf("%d",&T); while(T!=0) { scanf("%d",&k); for(i=0;i<k;i++) scanf("%d%d",&s1[i].n,&s1[i].m); for(i=0;i<k-1;i++) for(j=i+1;j<k;j++) if(s1[i].n>s1[j].n) { max=s1[i]; s1[i]=s1[j]; s1[j]=max; } for(i=0;i<k;i++) printf("%d\n",s1[i].m); T--; } return 0; }