struct stu
{
	int num;
	char c[26];
	struct stu*next;
};

struct stu*create(void)
{
	struct stu *p1,*p2,*head;
    int m;
	scanf("%d",&m);
	p1=(struct stu*)malloc(LEN);
	scanf("%d %s",&p1->num,p1->c);
	p2=p1;
	head=p1;

	while(m-1)
	{
		m--;
		p1=(struct stu*)malloc(LEN);
		scanf("%d %s",&p1->num,p1->c);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return head;
}

void print(struct stu*head,int z)
{
	struct stu*q;
	int i,k;
	char s[20],s0[20]={'\0'};
	q=head;
	while(q)
	{
		strcpy(s,q->c);
		k=strlen(s);
		for(i=0;i<k;i++)
			if(s[i]==z+65)
			{
				printf("%d\n",q->num);
				break;
			}
		strcpy(s,s0);
		q=q->next;
	}
}

void main()
{
	int index;
	int a[26],k,t,i,max=0;
	char s[20],s0[20]={'\0'};
	struct stu*p,*head;
	memset(a,0,sizeof(a));

	head=create();
	p=head;

	while(p)
	{
		strcpy(s,p->c);
		k=strlen(s);
		for(i=0;i<k;i++)
		{
			t=s[i]-65;
			a[t]++;
		}
		strcpy(s,s0);
		p=p->next;
	}

	for(i=0;i<26;i++)
		if(a[i]>max)
		{
			max=a[i];
			index=i;
		}
	printf("%c\n%d\n",index+65,max);
	print(head,index);
}


struct data
{
 int no;
 char au[10];
};
void main()
{
 struct data lib[1000];
 char x;
 int n,i,j,num[26]={0},l[1000],k,max;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&lib[i].no);
  scanf("%s",lib[i].au);
  l[i]=strlen(lib[i].au);
 }
 for(i=0;i<n;i++)
 {
  for(j=0;j<l[i];j++)
  {
   num[lib[i].au[j]-65]=num[lib[i].au[j]-65]+1;
  }
 }
 max=num[0];
 for(i=0;i<26;i++)
 {
  if(num[i]>max)
  {
   max=num[i];
   k=i;
  }
 }
 printf("%c\n",k+65);
 printf("%d\n",max);
 x=k+65;
 for(i=0;i<n;i++)
 {
  for(j=0;j<l[i];j++)
  {
   if(lib[i].au[j]==x)
   printf("%d\n",lib[i].no);
  }
 }
}


struct book
{
	int num;
	char au[30];
	struct book *next;
};
void main()
{
	int m;
	scanf("%d",&m);
	struct book *p1,*p2,*head;
	p1=(struct book*)malloc(LEN);
	scanf("%d %s",&p1->num,p1->au);
	p2=p1;
	head=p1;
	int n=1;
while(n<m)
{
	p1=(struct book*)malloc(LEN);
	scanf("%d %s",&p1->num,p1->au);
	p2->next=p1;
	p2=p1;
	n++;
}
p2->next=NULL;

char maxa;
char author;
char temp[30];
int an,maxn=0,i;
	struct book *p;

for(author='A';author<='Z';)
	{
		p=head;
	an=0;
		while(p)
		{
			strcpy(temp,p->au);

		for(i=0;(temp[i])!='\0';i++)
		{
		if(temp[i]==author){an++;break;}
		}
		p=p->next;
		}
if(an>maxn)
		{
		maxa=author;
		maxn=an;
}
	author=author+1;
}
printf("%c\n%d",maxa,maxn);
p=head;
while(p)
{
	strcpy(temp,p->au);
	for(i=0;(temp[i])!='\0';i++)
		{
		if(temp[i]==maxa)
		{	printf("\n");
			printf("%d",p->num);break;}
		}
	p=p->next;

}

}


struct tushu{
int bianhao;
char writer[27];
}book[1000];
void jishu(struct tushu *p1,int a[26],int b);
int max(int c[26]);
void shu(struct tushu *p2,int d,int e);

int main(){
	int n,i,m;
	int zimu[26];
	struct tushu *pointer;
	pointer=&book[0];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %s",&book[i].bianhao,&book[i].writer);
	}
	jishu(pointer,zimu,n);
	m=max(zimu);
	shu(pointer,m,n);
	return 0;
}
void jishu(struct tushu *p1,int a[26],int b){
	int j,k,diji;
	for(j=0;j<26;j++){
		a[j]=0;
	}
	for(j=0;j<b;j++){
		k=0;
		do{
			diji=(*(p1+j)).writer[k]-'A';
			a[diji]++;
			k++;
		}while((*(p1+j)).writer[k]!='\0');
	}
}
int max(int c[26]){
	int k,da,jieguo=0;
	da=c[0];
	for(k=1;k<26;k++){
		if(c[k]>da){
			da=c[k];
			jieguo=k;
		}
	}
	printf("%c\n%d\n",65+jieguo,da);
	return(jieguo);
}
void shu(struct tushu *p2,int d,int e){
	char ai=65+d;
	int x,y;
	for(x=0;x<e;x++){
		y=0;
		do{
			if((*(p2+x)).writer[y]==ai){
				printf("%d\n",(p2+x)->bianhao);
			}
			y++;
		}while((*(p2+x)).writer[y]!='\0');
	}
}


struct book
{
	int num;
	char wr[26];
	struct book *next;
};
void main()
{
	int i,n,m=0,j,a,b,c;
	int s[100]={0};
	scanf("%d",&n);
	struct book *head,*p1,*p2,*p;
	p1=p2=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->wr);
	head=NULL;
	while(m!=n-1)
	{
		m=m+1;
		if(m==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->wr);
	}
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	p=head;
	do
	{
		b=strlen(p->wr);
		for(j=0;j<b;j++)
			s[p->wr[j]]++;
		p=p->next;
	}while(p!=NULL);

	a=s[65];
	c=65;
	for(i=66;i<91;i++)
		if(a<s[i])
		{
			a=s[i];
			c=i;
		}
	printf("%c\n%d\n",c,a);

	p=head;
	do
	{
		b=strlen(p->wr);
		for(j=0;j<b;j++)
			if(p->wr[j]==c)
				printf("%d\n",p->num);
		p=p->next;
	}while(p!=NULL);
}


int main()
{
	int m,i,j;
	scanf("%d",&m);

	struct Bookinfo
	{
		int number;
		char auther[27];
	};

	struct Bookinfo a[1000];
	for (i=0;i<m;i++)
		scanf("%d %s",&a[i].number,a[i].auther);

	struct Author
	{
		int count;
		int number[1000];
	};

	struct Author b[26];
	for(i=0;i<26;i++) b[i].count=0;
	int max,record;

	for (i=0;i<m;i++)
	{
		int k;
		k=strlen(a[i].auther);
		for (j=0;j<k;j++)
		{
			b[a[i].auther[j]-'A'].number[b[a[i].auther[j]-'A'].count]=a[i].number;
			b[a[i].auther[j]-'A'].count++;
		}
	}

	max=b[0].count;
	for (i=0;i<26;i++)
		if (b[i].count>=max)
		{
			max=b[i].count;
			record=i;
		}
	printf("%c\n%d\n",record+'A',max);
	for (i=0;i<max;i++)
		printf("%d\n",b[record].number[i]);
	return 0;
}


struct book
{
	int id;
	char writer[30];
}book[1200];
int main()
{
	int n,l,t,a[30];
	char m;
	cin>>n;
	for(int i=0;i<30;i++)  a[i]=0;
	for(int i=0;i<n;i++)
	{
		cin>>book[i].id>>book[i].writer;
		l=strlen(book[i].writer);
		for(int j=0;j<l;j++)
		{
			t=book[i].writer[j]-65;
			a[t]++;
		}
	}
	t=a[0];l=0;
	for(int i=0;i<26;i++)
	{
		if(a[i]>t)
		{
			l=i;
			t=a[i];
		}
	}
	m=l+65;
	cout<<m<<endl;
	cout<<t<<endl;
	for(int i=0;i<30;i++)  a[i]=0;
	for(int i=0;i<n;i++)
	{
		l=strlen(book[i].writer);
		for(int j=0;j<l;j++)
		{
			if(book[i].writer[j]==m)
				cout<<book[i].id<<endl;
		}
	}
	return 0;
}


int main()
{
    char m = 0;
    int cnt[255], i, j, n;
    struct {
        int id;
        char au[32];
    } bk[1000];

    memset(cnt, 0, sizeof(cnt));
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d%s", &bk[i].id, bk[i].au);
        for (j = 0; bk[i].au[j]; j++)
            if (++cnt[bk[i].au[j]] > cnt[m])
                m = bk[i].au[j];
    }

    printf("%c\n%d\n", m, cnt[m]);
    for (i = 0; i < n; i++)
        if (strchr(bk[i].au, m))
            printf("%d\n", bk[i].id);

    return 0;
}


struct book
{
	int id;
	char author[26];
};
int main()
{
	struct book b[999];
	int a[26];
	int m,i,j,max,maxauthor;
	char c;
	scanf("%d",&m);
	for (i=0;i<m;i++)
	{
		scanf("%d %s",&b[i].id,b[i].author);
	}
	for (i=0;i<26;i++)
	{
		a[i]=0;
	}
	for (i=0;i<m;i++)
	{
		for (j=0;b[i].author[j]!='\0';j++)
		{
			c=b[i].author[j];
			a[c-65]++;
		}
	}
	max=a[0];
	maxauthor=0;
	for (i=1;i<26;i++)
	{
		if (a[i]>max)
		{
			max=a[i];
			maxauthor=i;
		}
	}
	printf("%c\n%d\n",maxauthor+65,max);
	for (i=0;i<m;i++)
	{
		for (j=0;b[i].author[j]!='\0';j++)
		{
			c=b[i].author[j];
			if (c==maxauthor+65)
			{
				printf("%d\n",b[i].id);
				break;
			}
		}
	}
	return 0;
}


struct book
{
	int id;
	char writer[26];
	int length;
}zz[999];
int main()
{
	int n,i,j,k;
	int letter[26]={0};
	int letter_book[26][999]={0};
	cin>>n;
	for ( i = 0 ; i < n; i ++ )
	{
		cin>>zz[i].id;
		cin>>zz[i].writer;
		zz[i].length=strlen(zz[i].writer);
	}

	for ( j = 0 ; j < n ; j ++ )
	{
		for ( k = 0 ; k < zz[j].length ; k ++  )
		{

			letter_book[zz[j].writer[k] - 'A'][letter[zz[j].writer[k] - 'A']] = zz[j].id;
			letter[zz[j].writer[k] - 'A'] ++;
		}
	}
	int max=0,t;
	for ( i = 0 ; i < 26 ; i ++ )
	{
		if ( letter[i] > max )
		{
			max = letter[i];
			t = i;
		}
	}
	char m;
	m = 'A' + t ;
	cout<<m<<endl;
	cout<<max<<endl;
	for ( i = 0 ; i < max ; i ++ )
		cout<<letter_book[t][i]<<endl;
}


int n=1,m;
struct zuozhe
{int num;
char ren[26];
struct zuozhe *next;
};
struct zuozhe *ap()
{
	struct zuozhe * head,*nw,*tn;
	do
	{
		nw=(struct zuozhe *)malloc(sizeof(struct zuozhe));
		scanf("%d%s",&nw->num ,nw->ren );
		if(n==1)
		{
			head=nw;
			tn=head;
		}
		else
			tn->next=nw;
		if(n<=m)
		{
			tn=nw;
			n++;
		}
	}while(n<=m);
	tn->next =NULL;
	return head;
}
int main()
{
	int i,max=0,a[26]={0},j,w,l;
	char z;
	struct zuozhe *head,*p;
	scanf("%d",&m);
	head=ap();
	p=head;
	for(;p!=NULL;p=p->next )
	{
		l=strlen(p->ren );
		for(i=0;i<l;i++)
		{
			j=p->ren [i]-65;
			a[j]++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(max<a[i])
		{
			max=a[i];
			w=i;
		}
	}
	z=65+w;
	printf("%c\n%d\n",z,max);
	p=head;
	for(;p!=NULL;p=p->next )
	{
		l=strlen(p->ren );
		for(i=0;i<l;i++)
		{
			if(p->ren [i]==z)
			{
				printf("%d\n",p->num );
				break;
			}
		}
	}
}


struct info
{
	int num;
	char author[30];
	struct info *next;
};
struct info*create(int n)
{
struct info *p1,*p2,*head;
int i;
p1=(struct info*)malloc(sizeof(struct info));
scanf("%d%s",&p1->num,p1->author);
p1->next=NULL;
p2=p1;
head=p1;
i=1;
while(i<n)
{
	p1=(struct info*)malloc(sizeof(struct info));
    scanf("%d%s",&p1->num,p1->author);
	p1->next=NULL;
	p2->next=p1;
	p2=p1;
	i++;
}
return head;
}

int main()
{
	int n,i,t,index,j;
	struct info *head,*p;
	int *g;
	scanf("%d",&n);
	head=create(n);
	g=(int*)malloc(26*sizeof(int));
	p=head;
    for(i=0,t=0;i<26;i++)
	{
	*(g+i)=0;
	}
	for(i=0;i<n;i++)
	{
		j=0;
		while(*(p->author+j)!='\0')
		{(*(g+(*(p->author+j))-65))++;j++;}
		p=p->next;
	}
    for(i=0,t=0;i<26;i++)
	{
	if(*(g+i)>t)
	{t=*(g+i);index=i;}
	}
    printf("%c\n",index+65);
	printf("%d\n",*(g+index));
    p=head;
	for(i=0;i<n;i++)
	{
		j=0;
		while(*(p->author+j)!='\0')
		{if(*(p->author+j)==index+65)
		{printf("%d\n",p->num);}
		j++;
		}
		p=p->next;
	}
}


struct data{
int code;
char author[20];
};
struct letter{
char let;
int count;
};

int main()
{
int n,i,j,k,t,max;
struct data a[100];
struct letter l[26];

scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i].code);
gets(a[i].author);
}
for(i=0;i<26;i++)
{
l[i].let=i+65;
l[i].count=0;
}

for(i=0;i<n;i++)
{
for(j=0;a[i].author[j]!='\0';j++)
{
for(k=0;k<26;k++)
{
if(a[i].author[j]==l[k].let)
l[k].count++;
}
}
}
   max=0;
   for(k=0;k<26;k++)                        {
   if(l[k].count>max)
   { max=l[k].count;
   t=k;}
   }

   printf("%c\n",l[t].let);
   printf("%d\n",l[t].count);
   for(i=0;i<=n-1;i++)
   {
   for(j=0;a[i].author[j]!='\0';j++)
{
if(a[i].author[j]==l[t].let)
printf("%d\n",a[i].code);
}
   }

return 0;
}


struct book
{
	int num;
	char author[26];
};
int main()
{
	int n;
	scanf("%d\n",&n);
	int i;
	struct book book[1000];
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&book[i].num,book[i].author);
	}
    int b[26]={0};
	for(i=0;i<n;i++)
	{
		int l;
		l=strlen(book[i].author);
		int j;
		for(j=0;j<l;j++)
		{
			b[book[i].author[j]-65]=b[book[i].author[j]-65]+1;
		}
	}
	int max=b[0];
	for(i=0;i<26;i++)
	{
		if(b[i]>max) max=b[i];
	}
    for(i=0;i<26;i++)
	{
		if(b[i]==max) break;
	}
	char p;
	p=i+65;
	printf("%c\n%d\n",p,max);
	for(i=0;i<n;i++)
	{   int j,l;
		l=strlen(book[i].author);
		for(j=0;j<l;j++)
		{
			if(book[i].author[j]==p) {printf("%d\n",book[i].num);break;}
			else if(book[i].author[j]!=p&&j==l-1) break;
		}
	}
	return 0;
}/*????????*/


struct BOOK
{
	int num;
	char author[26];
};

char maxbook(int a[])
{
	int i,j,bookmax=0;
	for(i=0;i<26;i++){
		if(bookmax<a[i]){
			bookmax=a[i];
			j=i;
		}
	}
	printf("%c\n%d\n",'A'+j,bookmax);
	return 'A'+j;
}

int contain(char author[],char max)
{
	char *c=author;
	while(*c){
		if(*c==max) return 1;
		c++;
	}
	return 0;
}

void main()
{
	struct BOOK book[1000];
	int m,i,j;
	char c,max;
	int AtoZ[26]={0};

	scanf("%d",&m);

	for(i=0;i<m;i++){
		scanf("%d",&book[i].num);
		getchar();
		j=0;
		while((c=getchar())!='\n'){
			book[i].author[j]=c;
			AtoZ[c-'A']++;
			j++;
		}
		book[i].author[j]='\0';
	}
	max=maxbook(AtoZ);

	for(i=0;i<m;i++){
		if(contain(book[i].author,max))
			printf("%d\n",book[i].num);
	}
}


struct a
{
	int book;
	char author[26];
	struct a *next;
};
struct a *creat(int m)
{
	int i=0;
	struct a *p,*head,*temp;
	head=NULL;
	do
	{
		p=(struct a *)malloc(sizeof(struct a));
			if(p==NULL){
			exit(1);
			}
			scanf("%d %s",&p->book,p->author);
			if(head==NULL){
			head=p;
			temp=p;}
			else{
				temp->next=p;
				temp=p;
			}
			i++;
	}while(i<m);
temp->next=NULL;
				return(head);
}
void main()
{
	int h,m,i,j,zimu[26]={0};
	struct a *head,*p;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++){
			if(p->author[j]>='A'&&p->author[j]<='Z')
			{
		zimu[p->author[j]-'A']++;
			}
		}
		p=p->next;
	}
	h=0;
	for(i=0;i<26;i++)
	{
		if(zimu[i]>zimu[h])
			h=i;
	}
	printf("%c\n%d\n",'A'+h,zimu[h]);
	p=head;
		for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++){
			if(p->author[j]=='A'+h)
			{
				printf("%d\n",p->book);
				break;
			}
		}
		p=p->next;
	}
}


int main()
{
  int m,i,j,k,q=0,t=0,u,max;
  int b[26]={0};
  char c[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  struct as{
    int sh;
    char a[26];
  }cla[1000];
  scanf("%d",&m);
  for(i=0;i<m;i++){
   scanf("%d %s",&cla[i].sh,cla[i].a);
   t=(int)strlen(cla[i].a);
   for(k=0;k<t;k++){
    u=cla[i].a[k]-'A';
    b[u]++;
   }
  }
  max=0;
  for(j=0;j<25;j++)
    if(max<b[j]){
      max=b[j];
      q=j;
    }
  printf("%c\n",c[q]);
  printf("%d\n",max);
  for(i=0;i<m;i++){
   t=(int)strlen(cla[i].a);
     for(k=0;k<t;k++)
      if(cla[i].a[k]==c[q])
       printf("%d\n",cla[i].sh);
  }
  return 0;
}


struct book
{
	int num;
	char author[26];
	struct book *next;
};
void main()
{
	int m,i,j,l,max,maxi;int n[26]={0};
	struct book *head,*p1,*p2;char *p;
	scanf("%d",&m);
	i=0;
	p1=p2=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->author);
	head=NULL;
	while(i<m)
	{
		i++;
		if(i==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		if(i<m)
		{
			p1=(struct book *)malloc(LEN);
			scanf("%d %s",&p1->num,p1->author);
		}
	}
	p2->next=NULL;
	p1=head;
	while(p1!=NULL)
	{
		l=strlen(p1->author);
		p=p1->author;
		for(i=0;i<l;i++)
		{

			for(j=0;j<26;j++)
				if(*(p+i)==j+64)
					n[j]++;
		}
		p1=p1->next;
	}
	max=n[0];
	for(i=1;i<26;i++)
	{
		if(n[i]>max)
		{
			max=n[i];
			maxi=i;
		}
	}
	printf("%c\n",maxi+64);

	printf("%d\n",max);

	p1=head;
	while(p1!=NULL)
	{
        l=strlen(p1->author);
		p=p1->author;
		for(i=0;i<l;i++)
		{

				if(*(p+i)==maxi+64)
				{
					printf("%d\n",p1->num);
					break;
				}
		}
		p1=p1->next;
	}
}


struct su
{
	int a;
	char b[26];
    struct su *next;
};
int main()
{
	int n,c[26]={0},i,k,j,l,max,m;
	struct su *p,*head,*q;
	scanf("%d",&n);

    for(i=0;i<n;i++)
	{
		p=(struct su *)malloc(sizeof(struct su));
		if(i==0)
		{head=p;
		q=p;
		scanf("%d %s",&p->a,p->b);
		k=strlen(p->b);
			for(j=0;j<k;j++)
			{
                l=p->b[j]-'A';
				c[l]=c[l]+1;
			}
		}
       else
	   {	q->next=p;
		q=p;
		scanf("%d %s",&p->a,p->b);
	    k=strlen(p->b);
			for(j=0;j<k;j++)
			{
                l=p->b[j]-'A';
				c[l]=c[l]+1;
			}
	   }

	}
	q->next=NULL;
	max=c[0];
	m=0;
	for(j=0;j<26;j++)
	{
        if(max<c[j])
		{max=c[j];
		m=j;
		}

	}
	printf("%c\n%d\n",m+'A',max);
	p=head;
	do
	{
        k=strlen(p->b);
		for(j=0;j<k;j++)
		{
			if(('A'+m)==p->b[j])
			{
				printf("%d\n",p->a);
			}
		}
		p=p->next;
	}while(p!=NULL);

return 0;
}


int main()
{
    int n,i,j,k,max;
    char name[2000][30],alp[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    int No[2000],num[30]={0};
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %s",&No[i],name[i]);
    }
    for(i=0;i<26;i++){
        for(k=0;k<n;k++){
            for(j=0;j<strlen(name[k]);j++){
                if(name[k][j]==alp[i]){
                    num[i]++;
                    break;
                }
            }
        }
    }
    max=num[0];
    for(i=1;i<26;i++){
        if(num[i]>max){
            max=num[i];
        }
    }
    for(i=0;i<26;i++){
        if(num[i]==max){
            printf("%c\n%d\n",alp[i],max);
            for(k=0;k<n;k++){
                for(j=0;j<27;j++){
                    if(name[k][j]==alp[i]){
                        printf("%d\n",No[k]);
                        break;
                    }
                }
            }
        }
    }
    return 0;
}


struct book
{  int n;
   char name[26];
   struct book *next;
};
struct book *head;
int m;
struct book *creat()
{struct book *p1,*p2;
 int i=0;
 p1=p2=(struct book*)malloc(LEN);
 scanf("%d %s",&p1->n,p1->name);
 head=NULL;
 while(i<m-1)
 {i=i+1;
 if(i==1) head=p1;
 else p2->next=p1;
 p2=p1;
 p1=(struct book*)malloc(LEN);
 scanf("%d %s",&p1->n,p1->name);
 }
 p2->next=p1;
 p1->next=NULL;
 return(head);
}
void main()
{
	int i,j,*p,max=0,n;
	struct book *p1;
	p=(int*)calloc(26,sizeof(int));
	scanf("%d",&m);
	creat();
	p1=head;
	for(i=65;i<=90;i++)
	{
		p1=head;
		do
		{
		for(j=0;(p1->name)[j]!='\0';j++)
			if((p1->name)[j]==i) *(p+i-65)=*(p+i-65)+1;
		p1=p1->next;
		}while(p1!=NULL);
	}
	for(i=0;i<26;i++,p++)
	{
		if(*p>max)
		{
			max=*p;
			n=i;
		}
	}
	printf("%c\n",n+65);
	printf("%d\n",max);
	p1=head;
	do
	{
      for(j=0;(p1->name)[j]!='\0';j++)
	  {
		  if((p1->name)[j]==n+65)
			  printf("%d\n",p1->n);
	  }
		p1=p1->next;
	}while(p1!=NULL);
}


struct book
{
	int name;
	char writer[26];
};
void main()
{
	struct book data[999];
	int m,i,j,max=0,b=0;
	int a[26]={0};
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d %s",&data[i].name,data[i].writer);
    for(i=0;i<m;i++)
		for(j=0;j<strlen(data[i].writer);j++)
			a[data[i].writer[j]-'A']++;
    for(i=0;i<26;i++)
		if(a[i]>max)
		{max=a[i];
		b=i;}
	printf("%c\n%d\n",('A'+b),max);
	for(i=0;i<m;i++)
		for(j=0;j<strlen(data[i].writer);j++)
		{if(data[i].writer[j]==('A'+b))
		{
		printf("%d\n",data[i].name);
			break;}
	}
}


struct author
{
    char name;
    int count;
}aut[26];

int max(struct author a[26])
{
    int i,max;
    max=a[0].count;
    for(i=0;i<26;i++)
        if(a[i].count>max)
            max=a[i].count;
    return(max);
}
void main()
{
    int m,h=0;
    scanf("%d",&m);
    int i,j,n,l[1000],book_name[1000];
    char author_name[1000][27];
    for(i=0;i<26;i++)
    {
    aut[i].name='A'+i;
    aut[i].count=0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%s",&book_name[i],author_name[i]);
        l[i]=strlen(author_name[i]);
        for(j=0;j<26;j++)
        for(n=0;n<l[i];n++)
                if(author_name[i][n]==aut[j].name)
                aut[j].count++;
    }
    for(i=0;i<26;i++)
    {
        if(aut[i].count==max(aut))
        {
            printf("%c\n",aut[i].name);
            h=i;
        }
    }
    printf("%d\n",max(aut));
    for(i=0;i<m;i++)
    {
        l[i]=strlen(author_name[i]);
        for(n=0;n<l[i];n++)
            if(author_name[i][n]==aut[h].name)
                printf("%d\n",book_name[i]);
    }
}


struct  book
{
    int  num;
    char  name[27];
    struct  book  *next;
};
   int  m;
struct  book   *head;

struct   book  *setup()
{   int  t=0;
    struct  book  *head,*p1,*p2;
    head=p1=p2=(struct  book  *)malloc(sizeof  (struct  book));
    scanf("%d %s",&p1->num,p1->name);
    while(t<m-1)
    {   t++;
        p2->next=p1;
        p2=p1;
        p1=(struct  book  *)malloc(sizeof(struct  book));
        scanf("%d %s",&p1->num,p1->name);
    }
    p2->next=p1;
    p1->next=NULL;
    return(head);
}
   int   k=0,max=0;
void   found(struct  book  *p)
{     int  i,j;
      p=head;
      int  *pi;
      pi=(int *)malloc(sizeof(int)*26);
      for(i=0;i<26;i++)  *(pi+i)=0;
      for(i=0;i<m;i++)
         {
              for(j=0;p->name[j]!='\0';j++)
              {
                         (*(pi+(p->name[j]-'A')))++;
              }
             p=p->next;
         }
         for(j=0;j<26;j++)
          {
                  if(*(pi+j)>max){
                   max=*(pi+j);
                   k=j;
                   }
          }

}
      int  main()
{   int  i,j;
    scanf("%d",&m);
    struct book *p;
     head=p=setup();
     found(p);
     printf("%c\n%d\n",(k+'A'),max);
     p=head;
     for(i=0;i<m;i++)
        {for(j=0;p->name[j]!='\0';j++)
           if(p->name[j]==k+'A'){
           printf("%d\n",p->num);
           break;
           }
           p=p->next;
        }
}


struct Student
{char name[26];
 int a;
};
int main()
{
	int n,i,k,l,m;
	char j,t;
	int b[26]={0};
	scanf ("%d",&n);
	struct Student stu[999];
	for (i=0;i<n;i++)
	{
		scanf ("%d %s",&stu[i].a,stu[i].name);
	}
	for (j='A',k=0;j<='Z';j++,k++)
		for (i=0;i<n;i++)
			for (l=0;l<26;l++)
				if (stu[i].name[l]==j)
					b[k]++;
	for (j='A',k=0,m=0;j<='Z';j++,k++)
		if (b[k]>m)
		{
			m=b[k];
		    t=j;
		}
	printf ("%c\n%d",t,m);
	for (i=0;i<n;i++)
		for (l=0;l<26;l++)
			if (stu[i].name[l]==t)
				printf ("\n%d",stu[i].a);
	return 0;
}


int main()
{
  char mo='A';
  int a[ASC]={0};
  int i,j,n;

 struct
{ int num;
  char wr[MAX_N+1];
}book[MAX_M];

scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d%s",&book[i].num,book[i].wr);
 for(j=0;book[i].wr[j];j++)
{if(++a[book[i].wr[j]]>a[mo]) mo=book[i].wr[j];}
}
printf("%c\n%d\n",mo,a[mo]);
for(i=0;i<n;i++)
if(strchr(book[i].wr,mo)) printf("%d\n",book[i].num);
return 0;
}


int main()
{
    int n;
    cin >> n;
    int number[n+1];
    int writer[26] = {0};
    char book[n+1][27];
    for(int i = 1; i <= n; ++i)
    {
            cin >> number[i] >> book[i];
            for(int t = 0; t < strlen(book[i]); ++t)
            {
                    writer[book[i][t] -'A']++;
            }
    }
    int nn = 0;
    for(int i = 0; i < 26; ++i)
    {
            nn = max(nn,writer[i]);
    }
    int person1;
    for(int i = 0; i < 26; ++i)
    {
            if(writer[i] == nn)
            {
                         person1 = i;
                         break;
            }
    }
    char person = person1 + 'A';
    cout << person  << endl << nn << endl;
    for(int i = 1; i <= n; ++i)
    {
            for(int t = 0; t < strlen(book[i]); ++t)
            {
                    if(book[i][t] == person)
                    {
                                  cout << number[i] << endl;
                                  break;
                    }
            }
    }
    //while(1);
    return 0;
}


int main()
{
	int m,len[1000],sum[26]={0},max,i,j,i0;
	scanf("%d",&m);
	struct book{
		int num;
		char wri[27];
	}book[1000];
	for(i=0;i<m;i++){
		scanf("%d %s",&book[i].num,book[i].wri);
		len[i]=strlen(book[i].wri);
	}
	for(i=0;i<m;i++)
		for(j=0;j<len[i];j++)
			sum[book[i].wri[j]-65]++;
	max=sum[0];
	i0=0;
	for(i=1;i<26;i++)
		if(sum[i]>max){
			max=sum[i];
			i0=i;
		}
	printf("%c\n",i0+65);
	printf("%d\n",max);
	for(i=0;i<m;i++)
		for(j=0;j<len[i];j++)
			if(book[i].wri[j]==65+i0){
				printf("%d\n",book[i].num);
				break;
			}
	return 0;
}


struct author{
	char num[4];
	char str[27];
};

int main(int argc, char* argv[])
{
	int m,i,j,zimu[26]={0},x,max;
	char p;
	scanf("%d",&m);
	struct author *auth=(struct author *)malloc(sizeof(struct author)*m);
	for(i=0;i<m;i++){
		scanf("%s %s",auth[i].num,auth[i].str);
	}
	for(i=0;i<m;i++){
		for(j=0;j<26;j++){
			x=auth[i].str[j]-65;
			zimu[x]++;
		}
	}
	max=zimu[0];
	for(i=0;i<26;i++){
		if(zimu[i]>max){
			max=zimu[i];
			p=i;
		}
	}
	printf("%c\n%d\n",p+65,max);

	for(i=0;i<m;i++){
		for(j=0;j<26;j++){
			if(auth[i].str[j]==p+65){
				printf("%s\n",auth[i].num);
			}
		}
	}

	free(auth);
	return 0;
}


int m;
struct book
{
	int num;
	char name[26];
	struct book *next;
};
struct book *create(void)
{
	struct book *head,*p1,*p2;
	int i;
	scanf("%d",&m);
	p1=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->name);
	head=NULL;
	for(i=1;i<m;i++)
	{
		if(i==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->name);
	}
	p2->next=p1;
	p1->next=NULL;
	return(head);
}
void main()
{
	int num[26]={0},i,j,max=0;
	struct book *p1,*p2,*head;
	char *p;
	p1=create();
	head=p1;
	for(i=0;i<m;i++)
	{
		for(p=p1->name;*p!='\0';p++)
		{
			num[(*p)-'A']++;
		}
		p1=p1->next;
	}
	for(i=0;i<26;i++)
	{
		if(num[i]>max)
		{
			max=num[i];
			j=i;
		}
	}
	printf("%c\n",('A'+j));
	printf("%d\n",max);
	p1=head;
	for(i=0;i<m;i++)
	{
		p=p1->name;
		for(p=p1->name;*p!='\0';p++)
		{
			if(*p==('A'+j))
			{
				printf("%d\n",p1->num);
				break;
			}
		}
		p1=p1->next;
	}
}


struct book{
	int num;
	char author[26];}shu[999];

int main(int argc, char* argv[])
{
	int m,b,i,*p;
	char c;
	int writer[26];
	char max(int *p);
	scanf("%d",&m);
	for(i=0;i<m;i++){
	scanf("%d%s",&shu[i].num,shu[i].author);}
	for(c='A',writer[c-'A']=0;c<='Z';c++){
		writer[c-'A']=0;
		for(i=0;i<m;i++){
			for(b=0;shu[i].author[b]!='\0';b++){
				if(c==shu[i].author[b]){
	writer[c-'A']++;}}}}
	p=writer;
	printf("%c\n%d\n",max(p),writer[max(p)-'A']);
		for(i=0;i<m;i++){
			for(b=0;shu[i].author[b]!='\0';b++){
				if(max(p)==shu[i].author[b]){
					printf("%d\n",shu[i].num);}}}

	return 0;
}
	char max(int *p){
		int i;
		char max;
		for(i=0,max='A';i<26;i++){
			if(*(p+i)>*(p+max-'A')){
				max=i+'A';}}
		return max;}


struct student
{
	int num;
	char zz[20];
	struct student *next;
};

struct student *New(int n)
{
	struct student *head=NULL;
	struct student *newp, *thisp;

	int i=0;

	do
	{
		newp=(struct student*)malloc(sizeof(struct student));
		if (newp==NULL)
		{
			printf("request failed\n");
			exit(-1);
		}
		scanf("%d %s",&newp->num,newp->zz);
		if (i==0)
		{
			head = newp;
			thisp = head;
		}
		else
			thisp->next = newp;
		if (i<n)//????????
		{
			thisp = newp;
			i=i+1;
		}
	}while(i<n);
	thisp->next=NULL;
	return (head);
}

void main()
{
	int i,j;
	int n;
	int t1=0,t2;
	int length;
	char target[1000]={' '};
	char mz=' ';

	struct student *head, *p;

	scanf("%d",&n);

	head=New(n);
	p=head;

	i=0;
	do
	{
		if (i==0)
		{
			strcpy(target,p->zz);
		}
		else
		{
			p = p->next;
			strcat(target,p->zz);
		}

		i+=1;
	}while(p->next != NULL);

	length=strlen(target);
	for(i=0;i<length;i++)//??????
	{
		t2=0;
		if (target[i]=='0')
			continue;
		else
		{
			for (j=i+1;j<length;j++)
			{
				if (target[j]==target[i])
				{
					target[j]='0';
					t2+=1;
				}
			}
			if (t2>t1)
			{
				t1=t2;
				mz=target[i];
			}
		}
	}

	printf("%c\n%d",mz,t1+1);

	p=head;
	do
	{
		length=strlen(p->zz);
		for (i=0;i<length;i++)
		{
			if ((p->zz[i])==mz)
			{
				printf("\n%d",p->num);
			}
		}
		p = p->next;
	}while(p != NULL);
}


struct book
{
	int ID;
	char author[30];
	struct book *next;
};
int n,max=0;
char c;

struct book *create()
{
	struct book *head,*p1,*p2;
	p1=(struct book*)malloc(LEN);
	scanf("%d %s",&p1->ID,p1->author);
	head=p1;
	p2=p1;
	p1->next=NULL;

	int i=1;
	do
	{
		if(i==n)break;
        p1=(struct book*)malloc(LEN);
		scanf("%d %s",&p1->ID,p1->author);
		p2->next=p1;
		p2=p1;
		p1->next=NULL;
		i++;
	}while(1);
	return(head);
}

int main()
{
	struct book *head;
	int i;
	int *num;
	num=(int*)malloc(26*sizeof(int));
	for(i=0;i<26;i++)
		*(num+i)=0;
	scanf("%d",&n);
	head=create();
	struct book *p;
	char *s;
	p=head;
	while(p)
	{
		for(s=p->author;*s!='\0';s++)
		{
			int temp;
			temp=*s-'A';
			(*(num+temp))++;
		}
		p=p->next;
	}
	for(i=0;i<26;i++)
	{
		if(*(num+i)>max)max=*(num+i);
	}
	for(i=0;i<26;i++)
	{
		if(*(num+i)==max)break;
	}
	printf("%c\n%d\n",'A'+i,max);
	c='A'+i;
	p=head;
	while(p)
	{
		for(s=p->author;*s!='\0';s++)
		{
			if(*s==c)break;
		}
		if(*s!='\0')printf("%d\n",p->ID);
		p=p->next;
	}
}


struct book
{
	int id;
	char s[26];
}a[100];
int main()
{
	int m,i,n,j,k,max,maxnum;
	int aut1[26]={0},aut2[26][100]={0};
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d",&a[i].id);
		gets(a[i].s);
		n=strlen(a[i].s);
		for(j=0;j<n;j++)
		{
			k=a[i].s[j]-'A';
			aut2[k][aut1[k]]=a[i].id;
            aut1[k]++;
		}
	}
    max=0;maxnum=0;
	for(i=0;i<26;i++)
	{
		if(aut1[i]>max)
		{
			max=aut1[i];
			maxnum=i;
		}
	}
	printf("%c\n",'A'+maxnum);
	printf("%d\n",max);
	printf("%d",aut2[maxnum][0]);
	for(i=1;i<max;i++)
	{
		printf("\n%d",aut2[maxnum][i]);
	}
}


struct student
{
	long num;
	char str[27];
	struct student *next;
};
int n;
struct student *creat(int m)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%ld %s",&p1->num,p1->str);
	head=0;
	while(p1->num!=0)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->str);
	}
	p2->next=0;
	return(head);
}
void main()
{
	struct student *head,*p,stu;
	int m,i,t,max,y=1,a[100]={0},sum[27]={0};
	char x=1,c;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	for(;p!=0;p=p->next)
	{
		for(t=0;t<strlen(p->str);t++)
		{
			c=p->str[t];
			sum[c-64]++;
		}
	}
	max=sum[1];
	for(i=1;i<=26;i++)
		if(sum[i]>max){max=sum[i];x=i;}
		for(p=head;p!=0;p=p->next)
		{
			for(t=0;t<=strlen(p->str);t++)
				if(p->str[t]==x+64)a[y]=p->num;
				y++;
		}
		printf("%c\n%d\n",x+64,max);
		for(y=1;y<=99;y++)
			if(a[y]!=0)printf("%d\n",a[y]);
}


void main()
{
	struct shu
	{
		int bian;
		char name[26];
	};

	struct shu a[1000];
	int n,i,j,l[1000],b[26]={0},most,good,k;

	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d%s",&a[i].bian,a[i].name);
	for(i=0;i<n;i++)
		l[i]=strlen(a[i].name);

	for(i=0;i<n;i++)
		for(j=0;j<l[i];j++)
			for(k=0;k<26;k++)
				if(a[i].name[j]==65+k)
					b[k]++;

				most=b[0];
				for(i=0;i<26;i++)
					if(b[i]>most)
					{
						most=b[i];
						good=i;
					}
					printf("%c\n",65+good);
					printf("%d\n",most);

					for(i=0;i<n;i++)
						for(j=0;j<26;j++)
							if(a[i].name[j]==65+good)
								printf("%d\n",a[i].bian);
}


void main()
{
int a[999],m,i,j,c[26],max=0,d,k;
scanf("%d\n",&m);
for(k=0;k<26;k++)
{
c[k]=0;
}
struct books
{
int num;
char name[26];
}
books[999];
for(i=0;i<m;i++)
{
scanf("%d %s",&books[i].num,books[i].name);
}
for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
c[books[i].name[j]-'A']++;
}
}
for(k=0;k<26;k++)
{
if(c[k]>max)
{
	max=c[k];
	d=k;
}
}
printf("%c\n%d\n",d+'A',max);

for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
if(books[i].name[j]==d+'A')
{
	printf("%d\n",books[i].num);
	break;
}
}
}
}


int main()
{
    int m,i,j,x,maxnumber;
    scanf("%d",&m);
    int booknum[1000];
    char k[1000][30];
    int author[27]={0};
    for(i=1;i<=m;i++)
    {
		scanf("%d %s",&booknum[i],k[i]);
		for(j=0;k[i][j]!='\0';j++)
		{
			author[k[i][j]-'A'+1]++;
		}
    }
    int max=0;
    for(i=1;i<=26;i++)
    {
		if(author[i]>max)
		{
			max=author[i];
			maxnumber=i;
		}
    }
    char who;
    who='A'+maxnumber-1 ;
    printf("%c\n",who);
    printf("%d\n",max);
    for(i=1;i<=m;i++)
    {
                     for(j=0;j<strlen(k[i]);j++)
                     if(k[i][j]==who)
                     printf("%d\n",booknum[i]);
    }
    return 0;
}


struct book
{
	int a;
	char b[30];
	struct book *next;
};
void main()
{
	int m,i,j,k,mid,l=0;
	int d[26],e[26];
	char c[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	struct book *head,*p1,*p2;
	scanf("%d",&m);
	head=p1=p2=(struct book *)malloc(LEN);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&p1->a,p1->b);
		p1=(struct book *)malloc(LEN);
		p2->next=p1;
		p2=p1;
	}
	p1=head;
	for(j=0;j<26;j++)
	{
		p1=head;
		l=0;
		for(i=0;i<m;i++)
		{
			for(k=0;k<strlen(p1->b);k++)
			{
				if(p1->b[k]==c[j])l++;
			}
			d[j]=l;e[j]=l;
			p1=p1->next;
		}
	}
	for(i=0;i<25;i++)
	for(j=0;j<25-i;j++)
	{
		if(d[j]<d[j+1])
		{
		    mid=d[j];d[j]=d[j+1];d[j+1]=mid;
		}
    }
    for(i=0;i<26;i++)
    {
    if(e[i]==d[0])break;
    }
    printf("%c\n",c[i]);
    printf("%d\n",d[0]);
    p1=head;
    for(j=0;j<m;j++)
    {
    	for(k=0;k<strlen(p1->b);k++)
    	{
    		if(p1->b[k]==c[i])printf("%d\n",p1->a);
    	}
    	p1=p1->next;
    }

}


char zimu[28]="ABCDEFGJIJKLMNOPQRSTUVWXYZ";
	char writer[10000][10000];
	int times[26],id[1000],i,len[10000],book=0;
	int n,j,k,tmax,max=0;

int main()
{

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&id[i],&writer[i]);
		len[i]=strlen(writer[i]);
	}
	for(i=0;i<26;i++)
	{
		times[i]=0;
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			for(k=0;k<26;k++)
			{

				if(writer[i][j]==zimu[k])
				{times[k]++;}
			}
		}

	}
	for(i=0;i<26;i++)
	{
		if(times[i]>max)
	{	max=times[i];
		tmax=i;
	}}
	printf("%c\n",zimu[tmax]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			if(writer[i][j]==zimu[tmax])
			{book++;}
		}
	}
	printf("%d\n",book);
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			if(writer[i][j]==zimu[tmax])
			{printf("%d\n",id[i]);}
		}
	}

	return 0;
}


struct book
{ char name[20];
  int num;
  struct book *next;
};

  struct book *creat(int m)
  {
	  int i;
	  struct book *head,*p1,*p2;
	  p1=(struct book *)malloc(len);
	  scanf("%d",&p1->num);
	  scanf("%s",p1->name);
	  p1->next=null;
	  head=p1;
	  p2=p1;
	  for(i=1;i<m;i++)
	  {
		  p1=(struct book *)malloc(len);
		  scanf("%d",&p1->num);
	      scanf("%s",p1->name);
		  p1->next=null;
		  p2->next=p1;
		  p2=p1;
	  }
	  return(head);
  }

  void main()
  {

  struct book *p,*head;
  int i,a[26],m;
  char *q;
  scanf("%d",&m);
  head=creat(m);
  p=head;
  char s[30];
  for(i=0;i<26;i++)
  a[i]=0;
  while(p){

	  i=0;
	   strcpy(s,p->name);
	   while(s[i]!='\0')
	   {
		   a[s[i]-'A']++;
           i++;
	   }
	  p=p->next;
  }
 /* for(i=0;i<26;i++)
  printf("%d",a[i]);*/
  //??

  int max=0,max_p;
   for(i=0;i<26;i++)
	  {
	   if(a[i]>max) {max=a[i];max_p=i+'A';}
   }
   printf("%c\n%d\n",max_p,max);
   //find max

   p=head;
   int x=0;
   char c[20];
   while(p){

	  i=0;
	   strcpy(c,p->name);
	   while(c[i]!='\0')
	   {

           if(c[i]==max_p) x=1;
		   i++;
	   }
	   if(x==1) printf("%d\n",p->num);
	   x=0;
	  p=p->next;
		  //if(strchr(p->name,max_p)) printf("%d\n",p->num);
	  }
   //??

  }


struct inf
{
	int num;
	char wri[27];
	struct inf *next;
};

void main()
{
	int n,i,time[26]={0};
	//for(i=0;i<26;i++)
//	printf("%d",time[i]);
	char *pn;
	struct inf *head,*p1,*p0,*p;
	scanf("%d",&n);
	p1 = head = (struct inf*)malloc(sizeof(struct inf));
	for (i=0;i<n;i++)
	{
	    p0 = (struct inf*)malloc(sizeof(struct inf));
		scanf("%d%s",&p0->num,p0->wri);
		p0->next = NULL;
		p1->next=p0;
		p1=p0;
		pn=p0->wri;
		while(*pn!='\0')
		{
			time[*pn-65]++;
		    pn=pn+1;
		}
	}

	int max=0,k;
	for (i=0;i<26;i++)
	{
		if (time[i]>max)
		{
			max=time[i];
			k=i;
		}
	}
	printf("%c\n%d\n",k+65,max);
	p=head;
	while(p!=NULL)
	{

		pn=p->wri;
		while(*pn!='\0')
		{
			if (*pn==k+65)
			{
				printf("%d\n",p->num);
				break;
			}
			pn=pn+1;
		}
		p=p->next;
	}

//	printf("%d",p->num);

}


struct student
{
	int num;
	char name[20];
	struct student* next;
};
struct student*creat(int n)
	{
		struct student*p1,*p2,*head;
		int i;
		p1=p2=(struct student*)malloc(len);
		head=NULL;
		i=0;
		while(i<n)
		{
			scanf("%d %s",&p1->num, p1->name);
			i=i+1;
			if(i==1) head=p1;
			else p2->next=p1;
			p2=p1;
			p1=(struct student *)malloc(len);
		}
		p2->next=NULL;
		return head;
	}
void main()
{
	int i;
	struct student *head,*p;
	int n;
	scanf("%d",&n);
	head=creat(n);
	p=head;
	int a[26];
	for (i=0; i<26; i++)
	{
		a[i]=0;
	}
	while (p!=NULL)
	{
		for (i=0;i<20;i++)
		{
			a[(int)p->name[i]-'A']++;
		}
		p = p->next;
	}
	int number, max = 0;
	for (i=0; i<26; i++)
	{
		if (a[i] > max)
		{
			max = a[i];
			number = i;
		}
	}
	printf ("%c\n", 'A'+number);
	printf ("%d\n", max);
	p = head;
	while (p!=NULL)
	{
		for (i=0;i<20;i++)
		{
			if (p->name[i] == 'A'+number)
				break;
		}
		if (p->name[i] == 'A'+number)
		printf ("%d\n", p->num);
		p = p->next;
	}
}


struct book
{
	int mark;
	char name[26];
};
int main()
{
    int m,h,i,j,k,max,length;
	int t[26];
	char a;
	scanf("%d",&m);
    struct book book[1000];
	for(i=0;i<m;i++)
	{
		scanf("%d%s",&book[i].mark,book[i].name);
	}
	for(i=0;i<26;i++)
	{
	    a='A'+i;
		t[i]=0;
		for(j=0;j<m;j++)
		{
		    length=strlen(book[i].name);

			for(h=0;h<26;h++)
			if(a==book[j].name[h])
			{
			    t[i]++;

			}

		}
	}
	max=0;
	for(i=0;i<26;i++)
	{
		if(t[i]>max)
		{
			max=t[i];
			k=i;
		}
	}
	a='A'+k;
	printf("%c\n%d\n",a,t[k]);
	for(i=0;i<m;i++)
	{
		length=strlen(book[i].name);
		for(j=0;j<26;j++)
		{
			if('A'+k==book[i].name[j])
				printf("%d\n",book[i].mark);
		}
	}
    return 0;
}


int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	struct{
		int a;
		char s[26];
	}zuozhe[1000];
	int i, k;
	for(i=0;i<n;i++){
		scanf("%d %s",&zuozhe[i].a, zuozhe[i].s);
	}
	int c[26]={0}, d;
	for(i=0;i<n;i++){
		d=strlen(zuozhe[i].s);
		for(k=0;k<d;k++){
			c[zuozhe[i].s[k]-65]++;
		}
	}
	int f;
	for(i=1;i<26;i++){
		if(c[i]>c[0]){
			f=i;
			d=c[i];
			c[i]=c[0];
			c[0]=d;
		}
	}
	printf("%c\n%d\n",f+65, c[0]);
	for(i=0;i<n;i++){
		d=strlen(zuozhe[i].s);
		for(k=0;k<d;k++){
			if(zuozhe[i].s[k]==f+65)
				printf("%d\n",zuozhe[i].a);
		}
	}
	return 0;
}


int main()
{
    int n;
    int i, j;
    int book_number[26];
    int max = 0;
    int max_n;
    int author_len;

    struct data
    {
           int number;
           char author[27];
    }input[1000];

    scanf("%d", &n);

    for(j = 0; j <= 25; j++)
          book_number[j] = 0;

    for(i = 0; i <= n - 1; i++)
    {
          scanf("%d %s", &input[i].number, input[i].author);
          author_len = strlen(input[i].author);

          for(j = 0; j <= author_len - 1; j++)
                book_number[input[i].author[j] - 'A']++;
    }

    for(j = 0; j <= 25; j++)
    {
          if(book_number[j] > max)
          {
                            max = book_number[j];
                            max_n = j;
          }
    }

    printf("%c\n%d\n", max_n + 'A', max);

    for(i = 0; i <= n - 1; i++)
    {
          author_len = strlen(input[i].author);

          for(j = 0; j <= author_len - 1; j++)
          {
                if(input[i].author[j] == max_n + 'A')
                {
                                      printf("%d\n", input[i].number);
                                      break;
                }
          }
    }
    return 0;
}


struct author
{
	int num;
	char aut[27];
}a[999];

void main()
{
	void search(struct author b[],int n,char marker);
	int m ,i,times[30]={0};
	int length=0,j;
	int max=0,flag=9;
	char chac;
	scanf("%d",&m);
//	printf("%d",m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&a[i].num,&a[i].aut);
	//	printf("%d %s",a[i].num,a[i].aut);
		length=strlen(a[i].aut);
		for(j=0;j<length;j++)
		{
			chac=a[i].aut[j];
			times[chac-'A']++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(max<times[i])
		{
			max=times[i];
			flag=i;
		}
	}
	printf("%c\n%d\n",(char)(flag+'A'),max);
	search(a,m,(char)(flag+'A'));
}

void search(struct author b[],int n,char marker)
{
	int i,j;
	for (i=0;i<n;i++)
	{
		for(j=0;j<strlen(b[i].aut);j++)
		{
			if(b[i].aut[j]==marker)
				printf("%d\n",b[i].num);
		}
	}
}


struct book
{
	int num;
	char name[20];
	struct book *next;
};
int i,j,n,t,number[100],m;
struct book *creat(void)
{
	struct book *p1,*p2,*head;
    p1=p2=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->name);
	head=NULL;
	for(i=1;i<m;i++)
	{
		if(i==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->name);
	}
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	return(head);
}
void main()
{
	scanf("%d",&m);
	struct book *creat(void);
	struct book *head,*p;
	int a[26]={0},max,maxindex=0;
	head=p=creat();
	char *pointer;
	do
	{
		for(pointer=p->name;*pointer!='\0';pointer++)
		{
			for(i=0;i<26;i++)
			{
				if(*pointer==65+i)
					a[i]++;
			}
		}
		p=p->next;
	}while(p!=NULL);
    max=a[0];
	for(i=1;i<26;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
			maxindex=i;
		}
	}
	printf("%c\n%d\n",65+maxindex,a[maxindex]);
	p=head;
	do
	{
		for(pointer=p->name;*pointer!='\0';pointer++)
		{
			if(*pointer==65+maxindex)
				printf("%d\n",p->num);
		}
		p=p->next;
	}while(p!=NULL);
}


struct
{
	int no;
	char wr[26];
}book[999];
struct
{
	char name;
	int num;
	int book[999];
}a[26];

int main()
{
	int n,m,t,k,d;
	int all=0;
	for (t=0;t<26;t++)
	{
		a[t].name='A'+t;
		a[t].num=0;
	}
	scanf("%d",&m);
	for (t=0;t<m;t++)
	{
		scanf("%d %s",&book[t].no,book[t].wr);
	}

	for (t=0;t<m;t++)
	{
		k=strlen(book[t].wr);
		for(n=0;n<k;n++)
		{
			for(d=0;d<26;d++)
			{
				if (a[d].name==book[t].wr[n])
				{
					a[d].book[a[d].num]=book[t].no;
					a[d].num++;
					break;
				}
			}
		}
	}
	k=0;

	for (t=0;t<26;t++)
	{
		if (k<a[t].num)
            k=a[t].num;
	}

	for (t=0;;t++)
	{
		if (k==a[t].num)
		{
			printf("%c",a[t].name);
			printf("\n%d",a[t].num);
			for (d=0;d<a[t].num;d++)
			printf("\n%d",a[t].book[d]);
			break;
		}
	}
}


struct book
{
int num;
char name[27];
struct book *next;
};

struct book *creat(int n)
{
 struct book *head,*p1,*p2;
 int m=0;
 head=p1=p2=NULL;
 p1=p2=(struct book *)malloc(sizeof(struct book));
 scanf("%d %s",&p1->num,p1->name);
 while(1)
 {
  m+=1;
  if(m>=n)break;
  if(m==1)head=p1;
  else p2->next=p1;
  p2=p1;
  p1=(struct book *)malloc(sizeof(struct book));
  scanf("%d %s",&p1->num,p1->name);
 }
p2->next=p1;
  p2=p1;
 p2->next=NULL;
 return(head);
}

void main()
{
 struct book *head,*p;
    char maxchar;
 int m,i=0,max=0,a[26]={0};
 scanf("%d",&m);
 head=creat(m);

 for(p=head;p!=NULL;p=p->next)
 {
	 //printf("%d,%s\n",p->num,p->name);
  for(i=0;p->name[i]!='\0';i++)
  {
   int c=p->name[i]-'A';
   a[c]++;
  }
 }

 for(i=0;i<26;i++)
 {
  if(a[i]>max)
  {
   max=a[i];
   maxchar='A'+i;
  }
 }

 printf("%c\n%d\n",maxchar,max);
 for(p=head;p!=NULL;p=p->next)
  for(i=0;p->name[i]!='\0';i++)
  {
   if(p->name[i]==maxchar)
   {
    printf("%d\n",p->num);
    break;
   }
  }
}


void main()
{
	struct book{
		int num;
		char str[30];
	}bk[1000]={0};
	int i,j,m,n,sum[100]={0},number[1000]={0},result,max=0;
	char temp='A';
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d %s",&bk[i].num,&bk[i].str);
	for(i=65;i<=90;i++){
		for(j=0;j<m;j++){
			for(n=0;n<26;n++)
				if(bk[j].str[n]==i)
					sum[i]++;
		}
	}
	for(j=0;j<26;j++){
		if(sum[j+65]>max){
			max=sum[j+65];
			temp=j+65;
			result=j+65;
		}
	}
	for(i=0;i<m;i++){
		for(n=0;n<30;n++)
			if(bk[i].str[n]==temp){
				number[i]=bk[i].num;
				break;
			}
	}
	printf("%c\n%d\n",temp,sum[result]);
	for(i=0;i<m;i++)
		if(number[i]!=0)
			printf("%d\n",number[i]);
}


struct book
{
	int no;
	char author[26];
}ji[1000];

main()
{
	int n,i,j,len,a[26][1000],e,b[26]={0},max=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&ji[i].no,ji[i].author);
		len=strlen(ji[i].author);
		for(j=0;j<len;j++)
		{
			e=ji[i].author[j];
			e=e-65;
			a[e][b[e]]=ji[i].no;
			b[e]=b[e]+1;
		}
	}
	for(i=0;i<26;i++)
		if(b[max]<b[i])
			max=i;
	printf("%c\n%d\n",max+65,b[max]);
	for(i=0;i<b[max];i++)
		printf("%d\n",a[max][i]);
	return 0;
}


struct book
{
	int num;
	char auth[26];
	struct book *next;
};
struct book *creat(int m)
{
	int i=0;
	struct book *head,*p1,*p2;
	if(i==0)
	{
		p1=(struct book*)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->auth);
		head=p1;
		p2=p1;
		p1->next=NULL;
		i++;
	}
	while(i<m)
	{
		p1=(struct book*)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->auth);
		p2->next=p1;
		p1->next=NULL;
		p2=p1;
		i++;
	}
	return (head);
}

int main()
{
	int m,i,lenth;
	int max=0,maxwh=27;
	int count[26]={0};
	struct book *head,*p;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	while(p!=NULL)
	{
		lenth=strlen(p->auth);
		for(i=0;i<lenth;i++)
			count[(int)(p->auth)[i]-65]++;
		p=p->next;
	}
	for(i=0;i<26;i++)
	{
		if(count[i]>max)
		{
			max=count[i];
			maxwh=i;
		}
	}
	printf("%c\n",maxwh+65);
	printf("%d\n",max);
	p=head;
	while(p!=NULL)
	{
		lenth=strlen(p->auth);
		for(i=0;i<lenth;i++)
		{
			if((int)(p->auth[i])==maxwh+65)
			{
				printf("%d\n",p->num);
				break;
			}
		}
		p=p->next;
	}
	return 0;
}


struct stu{
	int id;
	char author[26];
	int length;
}a[1000];

int main(){
	int n,i,k,num=0,max=0;
	char b,c;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%s",&a[i].id,a[i].author);
		a[i].length=strlen(a[i].author);
	}
	for(b='A';b<='Z';b++){
		num=0;
		for(i=0;i<n;i++){
			for(k=0;k<a[i].length;k++){
				if(a[i].author[k]==b){
					num++;
					break;
				}
			}
		}
		if(num>max){
			max=num;
			c=b;
		}
	}
	printf("%c\n%d\n",c,max);
	for(i=0;i<n;i++){
		for(k=0;k<a[i].length;k++){
			if(a[i].author[k]==c){
					printf("%d\n",a[i].id);
					break;
			}
		}
	}
	return 0;
}


int m,n;
struct student
{
	int id;
    char name[100];
	struct student* next;
};
struct student *creat()
{
	int i=1;
	struct student *head,*p1,*p2;
	p1=p2=(struct student*)malloc(len);
	scanf("%d",&m);
	scanf("%d %s",&p1->id,p1->name);
	head=NULL;
	for(;i<m;i++)
	{
		if(i==1) head=p1;
		p1=(struct student*)malloc(len);
		scanf("%d %s",&p1->id,p1->name);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return(head);
}

void main()
{
	struct student *head,*p1;
	int num[30]={0},max,j;
	char i,auth;
	head=creat();

	for(p1=head;p1!=NULL;p1=p1->next)
	{
		for(i='A';i<='Z';i++)
		{
			for(j=0;j<strlen(p1->name);j++)
				if(p1->name[j]==i)
				num[i-'A']++;
		}
	}
	for(i=0,max=0;i<26;i++)
	{
		if(num[i]>max)
		{
			max=num[i];
			auth=i+'A';
		}
	}
	printf("%c\n",auth);
	printf("%d\n",max);
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		for(j=0;j<strlen(p1->name);j++)
			if(p1->name[j]==auth)
			printf("%d\n",p1->id);
	}
}


int main()
{
	struct book
	{
		int num;
		char writer[26];
	}bookn[999];
	struct zuozhe
	{
		char w;
		int count;
	}zuozhen[26];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<26;i++)
	{
		zuozhen[i].w='A'+i;
		zuozhen[i].count=0;
	}
	int h=0;
	int m,j;
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&bookn[i].num,bookn[i].writer);
		m=strlen(bookn[i].writer);
		for(j=0;j<m;j++)
		{
			h=bookn[i].writer[j]-'A';
			zuozhen[h].count++;
		}
	}
	struct zuozhe a;
	a=zuozhen[0];
	for(i=1;i<26;i++)
	{
		if(a.count<zuozhen[i].count)
			a=zuozhen[i];
	}
	printf("%c\n",a.w);
	printf("%d\n",a.count);
	int t;
	for(i=0;i<n;i++)
	{
		t=strlen(bookn[i].writer);
		for(j=0;j<t;j++)
		{
			if(bookn[i].writer[j]==a.w)
				printf("%d\n",bookn[i].num);
		}
	}
}


int a[26][1000];
int ai[26];
void func()
{
    int k,i,len;
    char str[27];
    scanf("%d %s",&k,str);
    len=strlen(str);
    for(i=0;i<len;i++)
    {
        a[str[i]-'A'][ai[str[i]-'A']]=k;
        ai[str[i]-'A']++;
    }
}
int main()
{
    memset(a,0,sizeof(a));
    memset(ai,0,sizeof(ai));
    int n,i,i0,max=0;
    scanf("%d",&n);
    while(n--)
    func();
    for(i=0;i<26;i++)
    {
        if(ai[i]>max)
        {max=ai[i];
        i0=i;}
    }
    printf("%c\n",i0+'A');
    printf("%d\n",max);
    for(i=0;i<ai[i0];i++)
    printf("%d\n",a[i0][i]);
}


struct book
{
	int id;
	char s[L];
	int len;
}b[M];
void fun(int count[L],char s[L],int len)
{
	int i;
	for(i=0;i<len;i++)
	{
		int m;
		m=s[i]-'A';
		count[m]++;
	}
}
int judge(char s[L],int len,char name)
{
	int i,answer=0;
	for(i=0;i<len;i++)
	{
		if(s[i]==name)
		{
			answer=1;
			break;
		}
	}
	return answer;
}

int main()
{
	int m,k,count[L]={0},i,j,max,num;
	char name;
	scanf("%d",&m);
	for(k=0;k<m;k++)
	{
		scanf("%d%s",&b[k].id,b[k].s);
		b[k].len=strlen(b[k].s);
		fun(count,b[k].s,b[k].len);
	}
	max=count[0];
	num=0;
	for(j=1;j<L;j++)
	{
		if(count[j]>max)
		{
			max=count[j];
			num=j;
		}
	}
	name=num+65;
	printf("%c\n",name);
	printf("%d\n",max);
	for(k=0;k<m;k++)
	{
		int answer=0;
		answer=judge(b[k].s,b[k].len,name);
			if(answer==1)
				printf("%d\n",b[k].id);
	}
	return 0;
}


struct Bo{
	int num;
	char auth[30];
}a[1010];

void main(){
	int n,i,j,maxnum=0,max;
	int zuozhe[26]={0};
	char out;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d %s",&a[i].num,a[i].auth);
		for(j=0;j<=strlen(a[i].auth)-1;j++)
			zuozhe[a[i].auth[j]-'A']=zuozhe[a[i].auth[j]-'A']+1;
	}
	for(i=1;i<=25;i++)
		if(zuozhe[i]>zuozhe[maxnum]) maxnum=i;
	out='A'+maxnum;
	printf("%c\n",out);
	printf("%d\n",zuozhe[maxnum]);

	for(i=1;i<=n;i++)
	{
		if(strchr(a[i].auth,out)!=NULL) printf("%d\n",a[i].num);
	}
}


int main()
{
	struct bookinf
	{
		int code;
		char auth[27];
	}book[999];
	int i,k,m,max=0,num[26];
	for (i=0;i<26;i++)
		num[i]=0;
	scanf("%d", &m);
	for (i=0;i<m;i++)
	{
		scanf ("%d %s", &book[i].code, book[i].auth);
		for (k=0;book[i].auth[k]!='\0';k++)
				num[book[i].auth[k]-'A']+=1;
	}
	for (i=1;i<26;i++)
	{
		if (num[i]>num[max])
			max=i;
	}
	printf("%c\n%d\n", max+'A', num[max]);
	for (i=0;i<m;i++)
	{
		for (k=0;book[i].auth[k]!='\0';k++)
		{
			if (book[i].auth[k]==max+'A')
			{
				printf("%d\n", book[i].code);
				break;
			}
		}
	}
	return 0;
}


int main()
{
	int m;
	cin>>m;
	int num[1001];

	char name[1001][27];
	for(int i=0;i<m;++i)
	{
	   cin>>num[i];
	   cin.get();
	   cin.getline(name[i],27);
    }
	int count[100];memset(count, 0, sizeof(count));
	int record[27][1000];
	int start=0;
	int i,j;
	 char call;
	for( i=0;i<m;i++)
	{
	   for( j=0;j<strlen(name[i]);j++)
	   {
	      count[name[i][j]]++;
		   //call=name[i][j]-'A';
		  //record[call][start++]=num[i];
	   }
	}
	int max=0,k=0;
	char t;
	for(char w = 'A';w<='Z';w++)
	{
	   if(count[(int)w]>max)
		  { max=count[(int)w];
	   t=w;
	   }
    }
	cout<<t<<endl;
   cout<<max<<endl;
  for( i=0;i<m;i++)
	{
	   for( j=0;j<strlen(name[i]);j++)
	   {
	   if(name[i][j]==t)
	   {cout<<num[i]<<endl;  continue;  }
	   }
  }

   return 0;
}


struct book{
	int num;
	char author[26];
};
char max(int *p);

int main()
{
	int m,b,i,*p;
	struct book shu[999];
	char c;
	int writer[26];
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d%s",&shu[i].num,shu[i].author);
	}
	for(c='A',writer[c-'A']=0;c<='Z';c++){
		writer[c-'A']=0;
		for(i=0;i<m;i++){
			for(b=0;shu[i].author[b]!='\0';b++){
				if(c==shu[i].author[b]){
					writer[c-'A']++;
				}
			}
		}
	}
	p=writer;
	printf("%c\n%d\n",max(p),writer[max(p)-'A']);
	for(i=0;i<m;i++){
		for(b=0;shu[i].author[b]!='\0';b++){
			if(max(p)==shu[i].author[b]){
				printf("%d\n",shu[i].num);
			}
		}
	}
	return 0;
}
	char max(int *p)
	{
		int i;
		char max;
		for(i=0,max='A';i<26;i++){
			if(*(p+i)>*(p+max-'A')){
				max=i+'A';
			}
		}
		return max;
	}


int main(int argc, char* argv[])
{
	int n,i,j,m,b=0,max;
	int let[26]={0};
	char a;
	struct student{
		int num;
		char name[26];
	}book[999];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%s",&book[i].num,&book[i].name);
	}
	for(i=0;i<n;i++){
		m=strlen(book[i].name);
		for(j=0;j<m;j++){
			let[book[i].name[j]-'A']++;
		}
	}
	max=let[0];
	for(i=0;i<25;i++){
		if(let[i]>max){
			max=let[i];
			b=i;
		}
	}
	a=b+'A';
	printf("%c\n%d\n",a,max);
	for(i=0;i<n;i++){
		m=strlen(book[i].name);
		for(j=0;j<m;j++){
			if(book[i].name[j]==a){
				printf("%d\n",book[i].num);
			}
		}
	}
	return 0;
}


void main()
{
	struct book
	{
		char num[20];
		char ren[30];
		struct book *next;
	};

	int n;
	int a[26]={0};
	struct book *head,*p1,*p2;
	int i,j;
	char tem;
	char b[100][30];

	p1=(struct book *)malloc(L);
	head=p1;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s%s",p1->num,p1->ren);
		p2=p1;
		p1=(struct book *)malloc(L);
		p2->next=p1;
	}
	p1=head;
	for(i=0;i<n;i++)
	{
		for(j=0;j<strlen(p1->ren);j++)
		{
			int t=p1->ren[j]-'A';
			a[t]++;
		}
		p1=p1->next;
	}

	int max=0;
	for(i=0;i<26;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
			tem='A'+i;
		}
	}
	printf("%c\n",tem);
	p1=head;
	int u=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<strlen(p1->ren);j++)
		{
			if(p1->ren[j]==tem)
			{
				strcpy(b[u],p1->num);
				u++;
			}
		}
		p1=p1->next;
	}
	printf("%d\n",u);

	for(i=0;i<u;i++)
	{
		printf("%s\n",b[i]);
	}
}


int main()
{
    int n;
    scanf("%d",&n);
	struct book{
		int booknumber;
		char writer[27];
	}book[999];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&book[i].booknumber,book[i].writer);
	}
	int writerbookquantity[26];
	for(i=0;i<26;i++)writerbookquantity[i]=0;
	int j,len,x;
	for(i=0;i<n;i++)
	{
		len=strlen(book[i].writer);
		for(j=0;j<len;j++)
		{
            x= book[i].writer[j]-'A';
			writerbookquantity[x]++;
		}
	}
	int maxwriter=0,maxquantity=0;
    for(i=0;i<26;i++)
	{
       if(writerbookquantity[i]>maxquantity)
	   {
		   maxquantity=writerbookquantity[i];
		   maxwriter=i;
	   }
	}
	printf("%c\n%d\n",(char)(maxwriter+'A'),writerbookquantity[maxwriter]);
    for(i=0;i<n;i++)
	{
		len=strlen(book[i].writer);
		for(j=0;j<len;j++)
		{
            if((int)book[i].writer[j]==maxwriter+'A')
				printf("%d\n",book[i].booknumber);

		}
	}
	return 0;

}


int n;
struct stu
{int num;
char name[27];
struct stu *next;
};

struct stu *creat()
{int i=0; struct stu *head, *p1,*p2;
head=p1=p2=(struct stu*)malloc(sizeof(struct stu));
scanf("%d %s", &p2->num,p2->name);
while(i<n-1)
{i++; p2=(struct stu*)malloc(sizeof(struct stu));
scanf("%d %s", &p2->num,p2->name);
p1->next=p2;
p1=p2;}
return head;}

void main()
{struct stu *p,*head;
int k,u,max=0,maxnum;
int a[26]={0};
	scanf("%d",&n);
head=p=creat();
for (k=0;k<n;k++)
			{for (u=0;p->name[u]!='\0';u++)
				a[p->name[u]-'A']++;
			p=p->next;
			}
for(k=0;k<26;k++)
if(a[k]>max){max=a[k];maxnum=k;}
printf("%c\n%d\n",maxnum+'A',max);
p=head;
for(k=0;k<n;k++){
for(u=0;p->name[u]!='\0';u++)
if(p->name[u]==maxnum+'A'){printf("%d\n",p->num);break;}
p=p->next;
}}


int m;
struct book
{
	char num[20];
	char aut[20];
	struct book*next;
};
struct book*creat()
{
	struct book*head,*p1,*p2;
	int i;
	p1=(struct book*)malloc(LEN);
	scanf("%s %s",p1->num,p1->aut);
	p1->next=NULL;
	head=p1;
	p2=p1;
	for(i=1;i<m;i++)
	{
		p1=(struct book*)malloc(LEN);
	    scanf("%s %s",p1->num,p1->aut);
	    p1->next=NULL;
		p2->next=p1;
		p2=p1;
	}
	return(head);
}
void print(struct book*head)
{
	struct book*p;
	int*tem,i,k;
	char*q,max,c;
	tem=(int*)malloc(30*sizeof(int));
	for(i=0;i<30;i++)
	{
		*(tem+i)=0;
	}
	for(p=head;p;p=p->next)
	{
		q=p->aut;
		for(i=0;*(q+i)!='\0';i++)
		{
			c=*(q+i)-'A';
			*(tem+c)+=1;
		}
	}
	max=0;
	k=0;
	for(i=0;i<26;i++)
	{
		if(*(tem+i)>max)
		{
			max=*(tem+i);
			k=i;
		}
	}
	c=k+'A';
	printf("%c\n",c);
	printf("%d\n",max);
	for(p=head;p;p=p->next)
	{
		for(q=p->aut,i=0;*(q+i)!='\0';i++)
		{
			if(*(q+i)==c)
			{
				break;
			}
		}
		if(*(q+i)!='\0')
		{
			printf("%s\n",p->num);
		}
	}
}
int main()
{
	struct book*head;
	scanf("%d",&m);
	head=creat();
	print(head);
}


struct book
{
	int number;
	char author[26];
    struct book *next;
};
int m,i;
struct book *creat(void)
{
	struct book *head,*p1,*p2;
	int i=1;
	p1=p2=(struct book *)malloc(sizeof(struct book));
	head=p1;
	for(i=1;i<m;i++)
	{
		scanf("%d %s",&p1->number,p1->author);
		p1=(struct book *)malloc(sizeof(struct book));
		p2->next=p1;
		p2=p1;
	}
	scanf("%d %s",&p1->number,p1->author);
	p2->next=p1;
	p1->next=NULL;
	return head;
}
main()
{
	struct book *head,*p;
	int j,a[26]={0},max;
    scanf("%d",&m);
	head=creat();
	for(p=head;p!=NULL;p=p->next)
	for(i=0;i<strlen(p->author);i++)
		switch(p->author[i])
	{
	case 'A': a[0]++;break;
	case 'B': a[1]++;break;
	case 'C': a[2]++;break;
	case 'D': a[3]++;break;
	case 'E': a[4]++;break;
	case 'F': a[5]++;break;
	case 'G': a[6]++;break;
	case 'H': a[7]++;break;
	case 'I': a[8]++;break;
	case 'J': a[9]++;break;
	case 'K': a[10]++;break;
	case 'L': a[11]++;break;
	case 'M': a[12]++;break;
	case 'N': a[13]++;break;
	case 'O': a[14]++;break;
	case 'P': a[15]++;break;
	case 'Q': a[16]++;break;
	case 'R': a[17]++;break;
	case 'S': a[18]++;break;
	case 'T': a[19]++;break;
	case 'U': a[20]++;break;
	case 'V': a[21]++;break;
	case 'W': a[22]++;break;
	case 'X': a[23]++;break;
	case 'Y': a[24]++;break;
	case 'Z': a[25]++;break;
	}
	max=a[0];
	for(i=0;i<26;i++)
		if(a[i]>max)max=a[i];
    for(i=0;i<26;i++)
		if(a[i]==max)
		{printf("%c\n",65+i);break;}
		printf("%d\n",max);
	for(p=head;p!=NULL;p=p->next)
	for(j=0;j<strlen(p->author);j++)
		if(p->author[j]==65+i)printf("%d\n",p->number);
}


struct student
{
	int num;
	char str[27];
	struct student *next;
};
int n;
struct student *creat(int m)
{
	struct student *head;
	struct student *p1,*p2;

	p1=p2=(struct student*)malloc(LEN);
	scanf("%ld %s",&p1->num,p1->str);
	n=1;
	head=0;
	while(n<m)
	{
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->str);
		n=n+1;
	}
	p2->next=p1;
	p1->next=0;
	return(head);
}
void main()
{
	struct student *head,*p,stu;
	int m,i,t,max,y=1,a[100]={0},sum[27]={0};
	char x,c;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	for(;p!=0;p=p->next)
	{
		for(t=0;t<strlen(p->str);t++)
		{
			c=p->str[t];
			sum[c-'A'+1]++;
		}
	}
	max=sum[1];
	x=1;
	for(i=1;i<=26;i++)
		if(sum[i]>max){max=sum[i];x=i;}
		for(p=head;p!=0;p=p->next)
		{
			for(t=0;t<=strlen(p->str);t++)
				if(p->str[t]==x+'A'-1) {a[y]=p->num;y++;t=strlen(p->str)+1;}

		}
		printf("%c\n%d\n",x+64,max);
		for(y=1;y<=max;y++)
			printf("%d\n",a[y]);

}


struct book
{
	int num;
	char writer[26];
}book[1000];
void main()
{
	int n,i,j,e,max=0;
	scanf("%d",&n);
	char da,c;
	int temp[27]={0};
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&book[i].num,book[i].writer);
	}
	for(i=0;i<n;i++)
	{
		for(da='A';da<='Z';da++)
		{
			for(j=0;j<26;j++)
			{
				if(book[i].writer[j]==da)
					temp[da-'A'+0]++;
			}
		}
	}
	for(j=0;j<26;j++)
	{
		if(temp[j]>max)
		{
			max=temp[j];
		}
	}
	for(j=0;j<26;j++)
	{
		if(temp[j]==max)
		{
			c=j+65;
        printf("%c\n%d\n",c,temp[j]);
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<26;j++){
			if(book[i].writer[j]==c)
				printf("%d\n",book[i].num);
		}
	}
}


int main()
{
	int m, b, book[1000][27] = {0}, writer[26] = {0}, max = 0;
	char w;
	cin >> m;
	for(int i = 1; i <= m; i++)
	{
		cin >> b;
		book[i][26] = b;
		cin.get();
		while((w = cin.get()) != '\n')
		{
			writer[w - 'A']++;
			book[i][w - 'A'] = 1;
		}
	}
	for(int i = 1; i < 26; i++)
		if(writer[max] < writer[i])
			max = i;
	cout << (char) (max + 'A') << endl;
	cout << writer[max] << endl;
	for(int i = 1; i <= m; i++)
		if(book[i][max])
			cout << book[i][26] << endl;
	return 0;
}


void main()
{
	struct book
	{
		int num;
		char wri[26];
		struct book *next;
	};
	int n,m,i;
	scanf("%d",&m);
	struct book *head,*p1,*p2;
	n=0;
	p1=p2=(struct book *)malloc(L);
	scanf("%d%s",&p1->num,p1->wri);
	head=NULL;
	for(i=0;i<m-1;i++)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(L);
		scanf("%d%s",&p1->num,p1->wri);
	}
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	int a[26]={0},b,j,k,max1=0,max2;
	struct book *g;
	g=head;
	do
	{
		for(i=0;i<26;i++)
		{
			if(g->wri[i]!='\0')
			{
				b=g->wri[i];
				a[b-65]=a[b-65]+1;
			}
		}
		g=g->next;
	}while(g!=NULL);
	for(i=0;i<26;i++)
	{
		if(max1<a[i])
		{
			max1=a[i];
			max2=i;
		}
	}
	max2=max2+65;
	printf("%c\n%d",max2,max1);
	g=head;
	do
	{
		for(i=0;i<26;i++)
		{
			if(g->wri[i]==max2)
			{
				printf("\n%d",g->num);
				break;
			}
		}

		g=g->next;
	}while(g!=NULL);
}


struct book
{
	int num;
	char edt[27];
};
struct total   //??????????????
{
	char name;
	int amount;
};
int main()
{
	int m,i,j,k;
	struct book bk[1000];
	struct total to[27];
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d %s",&bk[i].num,bk[i].edt);
	for(i=0;i<26;i++)
	{
		to[i].name='A'+i;//????26???
		to[i].amount=0;
	}
	//???????????
	for(i=0;i<m;i++)
	{
		for(j=0;j<strlen(bk[i].edt);j++)
		{
			for(k=0;k<26;k++)
			{
				if(bk[i].edt[j]==to[k].name)
					to[k].amount ++;
			}
		}
	}
	//???????????????to[k]??
	for(i=k=0;i<26;i++)
	{
		if(to[i].amount>to[k].amount )
			k=i;
	}
	printf("%c\n%d\n",to[k].name ,to[k].amount );
	//??????????
	for(i=0;i<m;i++)
	{
		for(j=0;j<strlen(bk[i].edt);j++)
			if(bk[i].edt[j]==to[k].name)
				printf("%d\n",bk[i].num);
	}
	return 0;
}


int main()
{
	int n,i,j,k,w=0;
	int maxzm,maxbk=0;
	char c1;
	int zimu[26]={0};
	int lm[100];
	struct{
		int num;
		char a[100];
	}book[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	   scanf("%d %s",&book[i].num,book[i].a);
	for(i=0;i<n;i++)
	{
		for(j=0;book[i].a[j];j++)
		{
			for(k=65;k<91;k++)
			{
				if(book[i].a[j]==k)
					zimu[k-65]++;
			}
		}
	}
	for(i=0;i<26;i++)
	{
         if(zimu[i]>maxbk)
		 {
			 maxbk=zimu[i];
			 maxzm=i;
		 }
	}
	c1=maxzm+65;
	printf("%c\n",c1);
	printf("%d\n",maxbk);
	for(i=0;i<n;i++)
	{
		for(j=0;book[i].a[j];j++)
		{
			if(book[i].a[j]==c1)
			{
				lm[w]=book[i].num;
				w++;
				continue;
			}

		}
	}
	for(i=0;i<w;i++)
		printf("%d\n",lm[i]);

	return 0;
}


struct book
{
	int ID;
	char author[30];
	struct book *next;
};
int n,max=0;
char c;
int num[26]={0};
struct book *create()
{
	struct book *head,*p1,*p2;
	p1=(struct book*)malloc(LEN);
	scanf("%d %s",&p1->ID,p1->author);
	head=p1;
	p2=p1;
	p1->next=NULL;

	int i=1;
	do
	{
		if(i==n)break;
        p1=(struct book*)malloc(LEN);
		scanf("%d %s",&p1->ID,p1->author);
		p2->next=p1;
		p2=p1;
		p1->next=NULL;
		i++;
	}while(1);
	return(head);
}
void seek(struct book *head)
{
	struct book *p;
	char *s;
	p=head;
	while(p)
	{
		for(s=p->author;*s!='\0';s++)
		{
			int temp;
			temp=*s-'A';
			(*(num+temp))++;
		}
		p=p->next;
	}
}
void find(struct book *head)
{
	struct book *p;
	char *s;
	p=head;
	while(p)
	{
		for(s=p->author;*s!='\0';s++)
		{
			if(*s==c)break;
		}
		if(*s!='\0')printf("%d\n",p->ID);
		p=p->next;
	}
}

int main()
{
	struct book *head;
	int i;
	scanf("%d",&n);
	head=create();
	seek(head);
	for(i=0;i<26;i++)
	{
		if(*(num+i)>max)max=*(num+i);
	}
	for(i=0;i<26;i++)
	{
		if(*(num+i)==max)break;
	}
	printf("%c\n%d\n",'A'+i,max);
	c='A'+i;
	find(head);
}


struct book
{
	int num;
	char author[27];
	struct book *next;
};
void main()
{
	int m,i,j,k,a[26],sum=0;
	for(j=0;j<26;j++)
		a[j]=0;
	char aut;
	scanf("%d",&m);
	struct book *head,*pb1,*pb2;
	head=NULL;
	for(i=0;i<m;i++)
	{
		pb1=(struct book*)malloc(sizeof(struct book));
		scanf("%d %s",&pb1->num,pb1->author);
		for(j=0;pb1->author[j]!='\0';j++)
		{
			k=pb1->author[j]-'A';
			a[k]+=1;
		}
		if(head==NULL) {head=pb1;pb2=pb1;pb2->next=NULL;}
		else
		{
			pb2->next=pb1;pb2=pb1;pb2->next=NULL;
		}
	}
	for(j=0;j<26;j++)
	{if(a[j]>sum) {sum=a[j],k=j;}
	}
	aut=(char)('A'+k);
    printf("%c\n",aut);
    printf("%d\n",sum);
	pb1=head;
	while(pb1)
	{
		for(j=0;pb1->author[j]!='\0';j++)
			if(pb1->author[j]==aut) printf("%d\n",pb1->num);
        pb1=pb1->next;
	}
}


struct book
{
	int num;
	char writer[27];
	struct book *next;
};
int n;
int time[26]={0},max,k;
struct book *create(int m)
{
	struct book *head;
	struct book *p1,*p2;
	n=0;
	p1=p2=(struct book *)malloc(LEN);

	head=NULL;
	while(n<m)
	{
		scanf("%d %s",&p1->num,p1->writer);
		n=n+1;
		if(n==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(LEN);

	}
	p2->next=NULL;
	return (head);
}

void search(struct book *head)
{
	int i;
	struct book *p;
	p=head;
	if(head!=NULL)
	{
		do
		{
			for(i=0;(p->writer)[i]!='\0';i++)
				time[(p->writer)[i]-'A']++;
			p=p->next;
		}
		while(p!=NULL);
	}
}

void pr(struct book *head)
{
	int i;
	struct book *p;
	p=head;
	if(head!=NULL)
	{
		do
		{
			for(i=0;(p->writer)[i]!='\0';i++)
			{
				if((p->writer)[i]=='A'+k)
					printf("%d\n",p->num);
			}
			head = p;
			p=p->next;
			free(head);
		}
		while(p!=NULL);
	}
}

void main()
{
	int m,i;
	scanf("%d",&m);
	struct book *head;
	head=create(m);
	search(head);
	max=time[0];
	k=0;
	for(i=1;i<26;i++)
	{
		if(time[i]>max)
		{
			max=time[i];
			k=i;
		}
	}
	printf("%c\n%d\n",'A'+k,max);
	pr(head);
}


struct book
{
	int H;
	char writer[26];
}b[max];
int main()
{
	int m,i,j,k,sum[26]={0},t,Max,g;
	char y;
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&b[i].H,b[i].writer);
		t=strlen(b[i].writer);
		for(j=0;j<t;j++)
		{
			k=b[i].writer[j]-65;
			sum[k]++;
		}
	}
	Max=sum[0];
	for(i=0;i<26;i++)
	{
		if(sum[i]>Max)
			Max=sum[i];
	}
	for(i=0;i<26;i++)
	{
		if(sum[i]==Max)
		{
			y=i+65;
			printf("%c\n%d\n",y,Max);
		}
	}
	for(i=0;i<m;i++)
	{
		g=0;
		t=strlen(b[i].writer);
		for(j=0;j<t;j++)
		{
		if(b[i].writer[j]==y)
		{
			g++;
			break;
		}
		}
		if(g!=0)
			printf("%d\n",b[i].H);
	}
	return 0;
}


struct book
{
	int num;
	char aut[27];
	struct book *next;
};
int n;
struct book *creat(int amount)
{
	struct book *head;
	struct book *p1,*p2;
	n=0;
	p1=(struct book *)malloc(sizeof(struct book));
	p2=p1;
	scanf("%d %s",&p1->num,p1->aut);
	while(n<amount-1)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->aut);
	}
	p2->next=p1,p1->next=NULL;
	return(head);
}
int main()
{
	int amount,i,a[26]={0},max,maxn;
	struct book *p,*headp;
	char *auth,name[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','V','W','X','Y','Z'};
	scanf("%d",&amount);
	p=creat(amount);
	headp=p;
	for(p=headp;p!=NULL;p=p->next)
	{
		for(auth=p->aut;*auth!='\0';auth++)
		{
			for(i=0;i<26;i++)
			{
				if(name[i]==*auth)break;
			}
			a[i]=a[i]+1;
		}
	}
	for(i=0,max=a[0],maxn=0;i<26;i++)
	{
		if(a[i]>max)max=a[i],maxn=i;
	}
	printf("%c\n%d\n",name[maxn],max);
	for(p=headp;p!=NULL;p=p->next)
	{
		for(auth=p->aut;*auth!='\0';auth++)
		{
			if(*auth==name[maxn])break;
		}
		if(*auth=='\0');
		else printf("%d\n",p->num);
	}
}


struct book
{int num;
char a[27];
int y;
struct book *next;
};

void main()
{int n,i,j,k,m=0,num,max;
struct book *p1,*p2,*p,*head;
int c[26]={0};
scanf("%d",&n);
head=p1=p2=Z;
for(i=0;i<n;i++)
{p2->next=p1;
p2=p1;
scanf("%d%s",&p2->num,p2->a);
num=strlen(p2->a);
for(j=0;j<num;j++)
c[*(p2->a+j)-65]++;
p1=Z;
}
p2->next=0;

max=0;
for(i=0;i<26;i++)
if(c[i]>c[max])
max=i;
max=max+65;
p=head;
for(i=0;i<n;i++)
{num=strlen(p->a);
for(j=0;j<num;j++)
if(*(p->a+j)==max)
break;
if(j==num)
p->y=0;
else {p->y=1;m++;}
p=p->next;
}
p=head;
printf("%c\n%d\n",max,m);
for(i=0;i<n;i++)
{if(p->y==1)
printf("%d\n",p->num);
p=p->next;
}
}


int main()
{
	int m,sum[27]={0},max=0,author;
	cin>>m;
	char str[1000][4],name[1000][27];
	for(int i=0;i<m;i++)	cin>>str[i]>>name[i];
	for(int i=0;i<m;i++){
		for(int j=0;j<strlen(name[i]);j++)
			sum[name[i][j]-'A']++;
	}
	for(int i=0;i<26;i++){
		if(max<sum[i]){
			max=sum[i];
			author=i;
		}
	}
	cout<<(char)('A'+author)<<endl;
	cout<<max<<endl;
	for(int i=0;i<m;i++){
		for(int j=0;j<strlen(name[i]);j++){
			if(name[i][j]-'A'==author) cout<<str[i]<<endl;
		}
	}
	return 0;
}


char name[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int main()
{
	int n,t,i,j;
	int count[26],max=0;
	for(i=0;i<26;i++) count[i]=0;
	struct book
	{
		int num;
		char man[26];
	} book[999];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&book[i].num,book[i].man);
		for(j=0;book[i].man[j];j++)
		{
			if(book[i].man[j]=='A') count[0]++;
			else if(book[i].man[j]=='B') count[1]++;
			else if(book[i].man[j]=='C') count[2]++;
			else if(book[i].man[j]=='D') count[3]++;
			else if(book[i].man[j]=='E') count[4]++;
			else if(book[i].man[j]=='F') count[5]++;
			else if(book[i].man[j]=='G') count[6]++;
			else if(book[i].man[j]=='H') count[7]++;
			else if(book[i].man[j]=='I') count[8]++;
			else if(book[i].man[j]=='J') count[9]++;
			else if(book[i].man[j]=='K') count[10]++;
			else if(book[i].man[j]=='L') count[11]++;
			else if(book[i].man[j]=='M') count[12]++;
			else if(book[i].man[j]=='N') count[13]++;
			else if(book[i].man[j]=='O') count[14]++;
			else if(book[i].man[j]=='P') count[15]++;
			else if(book[i].man[j]=='Q') count[16]++;
			else if(book[i].man[j]=='R') count[17]++;
			else if(book[i].man[j]=='S') count[18]++;
			else if(book[i].man[j]=='T') count[19]++;
			else if(book[i].man[j]=='U') count[20]++;
			else if(book[i].man[j]=='V') count[21]++;
			else if(book[i].man[j]=='W') count[22]++;
			else if(book[i].man[j]=='X') count[23]++;
			else if(book[i].man[j]=='Y') count[24]++;
			else if(book[i].man[j]=='Z') count[25]++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(count[i]>max)
		{
			max=count[i];
			t=i;
		}
	}
	printf("%c\n%d\n",name[t],max);
	for(i=0;i<n;i++)
	{
		for(j=0;book[i].man[j];j++)
		{
			if(book[i].man[j]==name[t]) printf("%d\n",book[i].num);
		}
	}
	return 0;
}


struct jisuan{
         int num;
	char name[26];
}book[1000];
int main()
{
	int i,j,m,n,k,e;
	int count[26]={0},author[26];
	scanf("%d",&m);
	for(i=0;i<26;i++)
	         author[i]=65+i;
	for(i=0;i<m;i++){
		scanf("%d",&book[i].num);
		gets(book[i].name);
	}
	for(i='A';i<='Z';i++){
		for(j=0;j<m;j++){
			n=strlen(book[j].name);
			for(k=0;k<n;k++){
				if(i==book[j].name[k])
					count[i-65]++;
			}
		}
	}
	for(i=0;i<25;i++){
		if(count[i]>count[i+1]){
			e=count[i];
			count[i]=count[i+1];
			count[i+1]=e;
			e=author[i];
			author[i]=author[i+1];
			author[i+1]=e;
		}
	}
	printf("%c\n%d\n",author[25],count[25]);
	for(i=0;i<m;i++){
		n=strlen(book[i].name);
		for(k=0;k<n;k++){
			if(book[i].name[k]==author[25])
				printf("%d\n",book[i].num);
		}
	}
	return 0;
}


struct tushu
{
	int num;
	char name[26];
	struct tushu *next;
};
struct tushu *creat(int n)
{
	struct tushu *head,*p1,*p2;
	p1=p2=(struct tushu *)malloc(LEN);
	scanf("%d%s",&p1->num,p1->name);
	head=p1;
	int i;
	for(i=1;i<n;i++)
	{
		p1=(struct tushu *)malloc(LEN);
		scanf("%d%s",&p1->num,p1->name);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return(head);
}
int main()
{
	int n,num[26]={0},*p,i,j,max=0;
	char *a;
	scanf("%d",&n);
	struct tushu *head,*p1;
	head=creat(n);
	p=num;
	for(i=0;i<26;i++)
	{
		p1=head;
		a=p1->name;
		while(p1!=NULL)
		{
			for(j=0;*(a+j)!='\0';j++)
			{
	   	    	if(*(a+j)==i+65)
				{
					*(p+i)=*(p+i)+1;
					break;
				}
			}
			p1=p1->next;
			a=p1->name;
		}
	}
	for(i=1;i<26;i++)
	{
		if(*(p+max)<*(p+i)) max=i;
	}
	printf("%c\n",max+65);
	printf("%d\n",*(p+max));
	p1=head;
	a=p1->name;
	while(p1!=NULL)
	{
		for(i=0;*(a+i)!='\0';i++)
		{
			if(*(a+i)==(max+65))
			{
				printf("%d\n",p1->num);
				break;
			}
		}
		p1=p1->next;
		a=p1->name;
	}
return 0;
}


int main()
{
struct {
	int num;
	char author[26];
}book[1000];
int shu_num[26],i,j,k,n,max,length;
char max_author;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %s",&book[i].num,book[i].author);
}
for(k=0;k<26;k++){
	shu_num[k]=0;
}
for(k=0;k<26;k++){
	for(i=0;i<n;i++){
		length=strlen(book[i].author);
		for(j=0;j<length;j++){
			if(book[i].author[j]=='A'+k){
				shu_num[k]++;
			}
		}
	}
}
max=shu_num[0];
max_author='A';
for(k=0;k<26;k++){
	if(shu_num[k]>max){
	max=shu_num[k];
	max_author='A'+k;
	}
}
printf("%c\n%d\n",max_author,max);
for(i=0;i<n;i++){
	length=strlen(book[i].author);
	for(j=0;j<length;j++){
		if(book[i].author[j]==max_author){
		printf("%d\n",book[i].num);
		}
	}
}
	return 0;
}


int main()
{
    int num,temp;
    int author[27][500]={0,};
    char str[1000];
    cin>>num;
    for(int i=1;i<=num;i++)
    {
        cin>>temp;
        getchar();
        cin>>str;
        for(int j=0;j<strlen(str);j++)
        {
            author[str[j]-'A'+1][0]++;
            author[str[j]-'A'+1][author[str[j]-'A'+1][0]]=temp;
        }
    }
    int temp_num=0,temp_author;
    for(int i=1;i<=26;i++)
    {
        if(author[i][0]>temp_num)
        {
            temp_num=author[i][0];
            temp_author=i;
        }
    }
    cout<<(char)(temp_author+'A'-1)<<endl;
    cout<<temp_num<<endl;
    for(int i=1;i<=temp_num;i++)
    {
        cout<<author[temp_author][i]<<endl;
    }

    return 0;
}


struct people
{
	int a;
	char name[26];
};
void main()
{
	struct people pl[1000];
	int i,j,k,l=0,n,s,m,max,x[26];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&pl[i].a,pl[i].name);
	}
	for(i=0;i<n;i++)
	{
		m=strlen(pl[i].name);
		for(j=0;j<m;j++)
			for(k=0;k<26;k++)
				if(k==pl[i].name[j]-'A')
				{
					x[k]++;
					break;
				}
	}
	max=x[0];
	for(i=0;i<26;i++)
		if(x[i]>max) max=x[i];
	for(i=0;i<26;i++)
		if(x[i]==max)
		{
			printf("%c\n",'A'+i);
			s=i;
			printf("%d\n",x[i]);
			break;
		}
	for(i=0;i<n;i++)
		for(j=0;j<26;j++)
			if(pl[i].name[j]=='A'+s)
			{
				printf("%d\n",pl[i].a);
				break;
			}
}


struct
{
	int num;
	char au[27];
}book[999];

int main()
{
	int m,a[26]={0},i,j,t,max=0;
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d%s",&book[i].num,book[i].au);
		int au_n=strlen(book[i].au);
		for(j=0;j<au_n;j++)
		{
			if(book[i].au[j]<=90&&book[i].au[j]>=65)
			{
				int k=book[i].au[j]-65;
				a[k]++;
				if(a[k]>max) max=a[k];
			}
		}
	}
	for(i=0;i<26;i++)
	{
		if(a[i]==max)
		{
			char r=i+65;
			printf("%c\n%d\n",r,max);
			break;
		}
	}
	for(t=0;t<m;t++)
	{
		int au_n=strlen(book[t].au);
		for(j=0;j<au_n;j++)
		{
			if(book[t].au[j]==i+65) printf("%d\n",book[t].num);
		}
	}
	return 0;
}


struct chain
{
	int num;
	char name[27];
	struct chain *next;
};
void main()
{
	int a[26]={0},m,i,j,k,max=0,n;
	struct chain *p1,*p2,*head;
	scanf("%d",&m);
	p2=head=(struct chain *)malloc(LEN);
	for(k=0;k<27;k++)
		head->name[k]=0;
	scanf("%d%s",&head->num,&head->name);
	for(k=0;k<strlen(head->name);k++)
		{
			if(head->name[k]>=65&&head->name[k]<=90)
					a[head->name[k]-65]++;
		}
	for(j=0;j<m-1;j++)
	{
		p1=(struct chain *)malloc(LEN);
		p2->next=p1;
		for(k=0;k<27;k++)
			p1->name[k]=0;
		scanf("%d%s",&p1->num,&p1->name);
		p2=p1;
		for(k=0;k<strlen(p1->name);k++)
		{
			if(p1->name[k]>=65&&p1->name[k]<=90)
					a[p1->name[k]-65]++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(max<a[i])
		{
			max=a[i];
			n=i;
		}
	}
	printf("%c\n%d\n",n+65,max);
	p1=head;
	for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++)
		{
			if(p1->name[j]==(n+65))
			{
				printf("%d\n",p1->num);
				break;
			}
		}
		p1=p1->next;
	}
}


int main()
{
	int m;
	int i, j, a,n;
	struct book{
		int no;
		char name[30];
	}book[999];
	int author1[30]={0}, author2[30]={0};
	char k;
	scanf("%d", &m);
	for(i=0;i<m;i++)
		scanf("%d %s", &book[i].no, &book[i].name);
	for(i=0;i<m;i++){
		a = strlen(book[i].name);
		for(j=0;j<a;j++){
			for(k='A';k<='Z';k++){
				if(book[i].name[j]==k)
					author1[(int)k-65]++;
			}
		}
	}
	for(i=0;i<26;i++)
		author2[i]=author1[i];
	for(i=0;i<26;i++){
		for(j=i+1;j<26;j++){
			if(author1[i]<author1[j]){
				int tmp;
				tmp = author1[i];
				author1[i] = author1[j];
				author1[j]= tmp;
			}
		}
	}
	for(i=0;i<26;i++){
		if(author2[i] == author1[0]){
			printf("%c\n", (char)(65+i));
			printf("%d\n", author1[0]);
			for(j=0;j<m;j++){
				a = strlen(book[j].name);
				for(n=0;n<a;n++){
					if(book[j].name[n]==(char)(65+i)){
						printf("%d\n", book[j].no);
						break;
					}
				}
			}
		}
	}
	return 0;
}


struct book
{
   int num;
   char w[26];
   struct book *next;
};
int c[26],m,i,j=0,max;

struct book *creat(int m)
{
    struct book *head,*p1,*p2;
	p1=(struct book*)malloc(len);
    scanf("%d%s",&p1->num,p1->w);
	p1->next=NULL;
	p2=p1;
	head=p1;
	for(i=1;i<m;i++)
	{
		p1=(struct book*)malloc(len);
        scanf("%d%s",&p1->num,p1->w);
	    p1->next=NULL;
		p2->next=p1;
		p2=p1;
	}
	return head;
}
void a(struct book *head)
{
    struct book *p;
	char *x;
	int l,ch;
    p=head;
	for(i=0;i<m;i++)
	{
		for(x=p->w;x<p->w+26;x++)
		{
              l=(int)*x;
			  ch=l-65;

			  if(ch>=0) c[ch]=c[ch]+1;
		}
		p=p->next;
	}
}

void main()
{
	struct book *head,*p;
	struct book *creat(int m);
    void a(struct book *head);
	char writer,*x;
	int wri,b[200];
	for(i=0;i<26;i++) c[i]=0;
	for(i=0;i<200;i++) b[i]=0;
	scanf("%d",&m);
	head=creat(m);
	a(head);
	max=0;
	j=0;
	for(i=0;i<26;i++)
	{
        if(c[i]>max)
		{
		wri=i+65;
		max=c[i];

		}
	}
	printf("%c\n",wri);
    p=head;
	for(i=0;i<m;i++)
	{
		for(x=p->w;x<p->w+26;x++)
		{
			if(*x==(char)wri)
			{
				b[j]=p->num;
				j=j+1;
				break;
			}
		}
		p=p->next;
	}
printf("%d\n",j);
for(j=0;b[j]>0;j++) printf("%d\n",b[j]);

}


int max,n,x,b[30]={0};
struct book
{
	int num;
	char author[30];
	struct book*next;
};

struct book*creat()
{
	struct book*head,*p1,*p2;
	p2=NULL;
	head=(struct book*)malloc(len);
	p1=head;
	while(n>0)
	{
		char a[30];int i,j;
		p2=p1;
		x=0;
		scanf("%d%s",&p1->num,&p1->author);
		strcpy(a,p1->author);
		max=b[0];
		for(i=0;a[i]!='\0';i++)
		{
			for(j='A';j<='Z';j++)
			{
				if(j==a[i])
				b[j]++;
			}
		}
		for(j='A';j<='Z';j++)
		{
			if(b[j]>max)
			{
				max=b[j];
				x=j;
			}
		}
		p1=(struct book*)malloc(len);
		p2->next=p1;
		n--;
	}
	p2->next=NULL;
	printf("%c\n%d\n",x,max);
	return head;

}
struct book*print(struct book*head,char x)
{
	struct book*p1;
	p1=head;
	int i;
	while(p1!=NULL)
	{
		char a[30];
		strcpy(a,p1->author);
		for(i=0;a[i]!='\0';i++)
		{
			if(a[i]==x)
				printf("%d\n",p1->num);
		}
		p1=p1->next;
	}
	return head;
}
void main()
{
	scanf("%d",&n);
	struct book*head;
	head=creat();
	print(head,x);
}


struct book
{
	int num;
	char name[26];
	struct book *next;
};
struct book *creat(int m)
{
	struct book *head,*p1,*p2;
	p1=(struct book *)malloc(sizeof(struct book));
	scanf("%d %s",&p1->num,p1->name);
	int i;
	for(i=1;i<m;i++)
	{
		if(i==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->name);
	}
	p2->next=p1;p1->next=NULL;
	return(head);
}
main()
{
	struct book *head,*p;
	int i,j,m,k,l,max=0;
	scanf("%d",&m);
	head=creat(m);
	int *a;
	a=(int *)malloc(26*sizeof(int));
	for(i=0;i<26;i++)
		*(a+i)=0;
	p=head;
	for(i=0;i<m;i++)
	{
		k=strlen(p->name);
		for(j=0;j<k;j++)
			for(l=0;l<26;l++)
				if(*(p->name+j)==l+65)
					(*(a+l))++;
		p=p->next;
	}
	for(i=0;i<26;i++)
		if(max<*(a+i)) max=*(a+i);
	for(i=0;i<26;i++)
		if(max==*(a+i)) {printf("%c\n%d\n",i+65,max);break;}
	p=head;
	for(j=0;j<m;j++)
	{
		k=strlen(p->name);
		for(l=0;l<k;l++)
			if(*(p->name+l)==i+65)
				printf("%d\n",p->num);
		p=p->next;
	}
}


struct BOOK
{
	int No;
	char author[27];
}book[999];
int letter[26]={0};

main()
{
	int letter[26]={0};
	int count=0;
	int m,n,s;
	scanf("%d",&m);
	int i,j,max;
	for(i=0;i<m;i++){
		scanf("%d%s",&book[i].No,&book[i].author);
	}
	for(i=0;i<m;i++){
		for(j=0;j<strlen(book[i].author);j++){
			n=book[i].author[j]-65;
			letter[n]++;
		}
	}
	max=letter[0];
	for(n=0;n<26;n++){
		if(letter[n]>max){
			max=letter[n];
		}
	}
	for(n=0;n<26;n++){
		if(max==letter[n]){
			s=n;
			printf("%c\n%d\n",n+65,max);
			break;
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<strlen(book[i].author);j++){
			if(s==book[i].author[j]-65){
				printf("%d\n",book[i].No);
			}
		}
	}
}


struct Book
{
	int number;
	char author[30];
};

void main()
{
	int max=0,len;
	int sum[30]={0};
	int m,i,j;
	struct Book book[999];
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&book[i].number,book[i].author);
		len=strlen(book[i].author);
		for(j=0;j<len;j++)
			sum[book[i].author[j]-65]++;
	}
	for(i=0;i<26;i++)
	{
		if(sum[i]>sum[max])
			max=i;
	}
	printf("%c\n%d\n",max+65,sum[max]);
	for(i=0;i<m;i++)
	{
		len=strlen(book[i].author);
		for(j=0;j<len;j++)
		{
			if(book[i].author[j]==max+65)
			{
				printf("%d\n",book[i].number);
				break;
			}
		}
	}
}


struct book
{
	long int num;
	char name[26];
}book[1000];
int main()
{
	int m,i,j,r;
	int writer[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
	scanf("%d",&m);
    for(i=0;i<m;i++)
	{
       scanf("%ld ",&book[i].num);
	   scanf("%s",book[i].name);
	}
    for(i=0;i<m;i++)
	{
		r=strlen(book[i].name);
		for(j=0;j<r;j++)
		{
				writer[book[i].name[j]-'A']++;
		}
	}
	int max=0;
	char w='A';
	for(i=0;i<26;i++)
	{
		if(writer[i]>max)
		{
			max=writer[i];
			w=i+'A';
		}
	}
	printf("%c\n",w);
	printf("%d\n",max);
	for(i=0;i<m;i++)
	{
		for(j=0;j<r;j++)
		{
			r=strlen(book[i].name);
			if(book[i].name[j]==w)
			{
				printf("%ld\n",book[i].num);
			}
		}
	}
	return 0;
}


int main()
{
	struct book
	{
		int num;
		char author[26];
	}list[999],*p;

	int n;
	int count[26]={0};
	int i;
	char k='A';
	int max;

	scanf("%d",&n);
	for(p=list;p<list+n;p++){
		scanf("%d %s",&p->num,p->author);
	}

	for(p=list;p<list+n;p++){
		for(i=0;;i++){
			if(p->author[i]=='\0'){
				break;
			}else{
				count[p->author[i]-65]++;
			}
		}
	}

	max=count[0];
	for(i=1;i<26;i++){
		if(count[i]>max){
			max=count[i];
			k=i+65;
		}
	}

	printf("%c\n",k);
	printf("%d\n",max);

	for(p=list;p<list+n;p++){
		for(i=0;;i++){
			if(k==p->author[i]){
				printf("%d\n",p->num);
			}
			if(p->author[i]=='\0'){
				break;
			}
		}
	}

	return 0;
}


int main()
{
	char book[1000][20]={'\0'},name[1000][30]={'\0'};
	int length,n,i,j,number[30]={0},memory,largest,temp;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",book[i],name[i]);
	}
	for(i=0;i<n;i++)
	{
		length=strlen(name[i]);
		for(j=0;j<length;j++)
		{
			temp=name[i][j]-'A';
			number[temp]+=1;
		}
	}
	largest=0;
	for(i=0;i<26;i++)
	{
		if(number[i]>largest)
		{
			largest=number[i];
			memory=i;
		}
	}
	printf("%c\n%d\n",'A'+memory,number[memory]);
	for(i=0;i<n;i++)
	{
		length=strlen(name[i]);
		for(j=0;j<length;j++)
		{
			if(name[i][j]=='A'+memory)
			{
				printf("%s\n",book[i]);
			}
		}
	}
	return 0;
}


void main()
{
	struct book
	{
		int number;
		char author[10];
	};
	struct book a[1000];
	int i,n,j,count[26]={0},temp,max,index=0;
	char c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
    scanf("%d %s",&a[i].number,&a[i].author);
    for(i=0;i<n;i++)
		for(j=0;a[i].author[j]!='\0';j++)
		{	temp=(a[i].author[j])-'A';
		    count[temp]++;
		}
     max=count[0];
	 for(i=1;i<26;i++)
		 if(count[i]>max)
		 {max=count[i];
			 index=i;
		 }
    c=index+'A';
	printf("%c\n%d\n",c,max);
		 for(i=0;i<n;i++)
			 for(j=0;a[i].author[j]!='\0';j++)
				 if(a[i].author[j]==c)
					 printf("%d\n",a[i].number);
}


int pp[26]={0};

struct st
{
	char name[27];
	int num;
	struct st *next;
};

struct st *creat(int m)
{
	struct st *head,*p1,*p2;
	int i,j;
	p1=(struct st *)malloc(sizeof(struct st));
	scanf("%d %s",&p1->num,p1->name);
	for (j=0;;j++)
	{
		if (isupper(p1->name[j])) pp[p1->name[j]-65]++;
			else break;
	}
	p2=p1;
	head=p1;
	for (i=1;i<m;i++)
	{
		p1=(struct st *)malloc(sizeof(struct st));
		scanf("%d %s",&p1->num,p1->name);
		for (j=0;;j++)
		{
			if (isupper(p1->name[j])) pp[p1->name[j]-65]++;
				else break;
		}
		p1->next=NULL;
		p2->next=p1;
		p2=p1;
	}
	return(head);
}

void main()
{
	struct st *creat();
	struct st *head,*p;
	int n,i,max,j;
	scanf("%d",&n);
	head=creat(n);
	p=head;
	max=0;
	for (i=1;i<26;i++)
		if (pp[i]>pp[max]) max=i;
	printf("%c\n%d\n",max+65,pp[max]);
	while(p)
	{
		for (j=0;;j++)
		{
			if (isupper(p->name[j]))
			{
				if (p->name[j]==(max+65)) printf("%d\n",p->num);
			}
			else break;
		}
		p=p->next;
	}

}


int main()
{
	struct books
	{
		int book;
		char writer[20];
	}bk[1000];
	int n,i,j,m,max,k,maxw=0,flag=0,a[26]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&bk[i].book,bk[i].writer);
	}
	for(i=0;i<n;i++)
	{
		m=strlen(bk[i].writer);
		for(j=0;j<m;j++)
		{
			k=bk[i].writer[j];
			a[k-65]++;
		}
	}
	max=a[0];
	for(i=1;i<26;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
			maxw=i;
		}
	}
	printf("%c\n%d\n",maxw+65,max);
	for(i=0;i<n;i++)
	{
		m=strlen(bk[i].writer);
		for(j=0;j<m;j++)
		{
			if(maxw+65==bk[i].writer[j])
				printf("%d\n",bk[i].book);

		}
	}
	return 0;
}


int main()
{
	int m,i,j;
	scanf("%d",&m);

	struct Bookinfo
	{
		int number;
		char auther[27];
	};

	struct Bookinfo a[1000];
	for (i=0;i<m;i++)
		scanf("%d %s",&a[i].number,a[i].auther);

	int count[26]={0},max,record;

	for (i=0;i<m;i++)
	{
		int k;
		k=strlen(a[i].auther);
		for (j=0;j<k;j++)
		{
			count[a[i].auther[j]-'A']++;
		}
	}

	max=count[0];
	for (i=0;i<26;i++)
		if (count[i]>=max)
		{
			max=count[i];
			record=i;
		}

	printf("%c\n%d\n",record+'A',max);

	for (i=0;i<m;i++)
	{
		int n;
		n=strlen(a[i].auther);
		for (j=0;j<n;j++)
			if (a[i].auther[j]==record+'A')
			{
				printf("%d\n",a[i].number);
				break;
			}
	}

	return 0;
}


int main()
{
	int bkn,m=1,n,i,j;
	char bka[30];

	struct author
	{
		int num;
		int p[200];
	}
	a[30];
	scanf("%d",&n);
	for(i=1;i<27;i++)
		a[i].num=0;
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&bkn,bka);
		for(j=0;j<strlen(bka);j++)
		{
			a[bka[j]-64].num++;
			a[bka[j]-64].p[a[bka[j]-64].num-1]=bkn;
		}
	}
	for(i=2;i<27;i++)
		if(a[i].num>a[m].num)
			m=i;
	printf("%c\n%d\n",m+64,a[m].num);
	for(i=0;i<a[m].num;i++)
		printf("%d\n",a[m].p[i]);

	return 0;
}


struct shu
{
	int hao;
	char zuo[26];
	struct shu*next;
};
int main()
{
	int m,a[26]={0},i,j,b[26][1000],k,max;
	struct shu*p1,*p2,*head=NULL,*p;
	scanf("%d",&m);
    p1=p2=(struct shu*)malloc(len);
	scanf("%d %s",&p1->hao,p1->zuo);
	head=p1;
	for(i=2;i<=m;i++)
	{
		p1=(struct shu*)malloc(len);
		scanf("%d %s",&p1->hao,p1->zuo);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	for(i=0,max=0;i<=25;i++)
	{
		for(p=head,k=1;p!=NULL;p=p->next)
		{
			for(j=0;j<=25;j++)
				if(p->zuo[j]=='A'+i)
				{
					a[i]++;
					b[i][k]=p->hao;
					k++;
				}
		}
		if(a[i]>max)
			max=a[i];
	}
	for(i=0;i<=25;i++)
	{
		if(a[i]==max)
		{
			printf("%c\n%d\n",'A'+i,max);
			for(k=1;k<=max;k++)
				printf("%d\n",b[i][k]);
			break;
		}
	}
	return 0;
}


struct worker
{
	int nm;
	char name1[26];
	struct worker *next;
};
struct zuozhe
{
	char nam;
	int counts;
	int  name[1000];
	struct zuozhe *next;
};
struct worker *creat1(int n)
{
	struct worker *head,*p1,*p2;
	int i;
	head=(struct worker *)malloc(sizeof(struct worker));
	p1=p2=head;
	for(i=0;i<n;i++)
	{
		p2=p1;
		p1=(struct worker *)malloc(sizeof(struct worker));
		scanf("%d %s",&p2->nm,p2->name1);
		p2->next=p1;
	}
	p2->next=0;
	return head;
}
struct zuozhe *creat2()
{
	struct zuozhe *head,*p1,*p2;
	int i;
	head=(struct zuozhe *)malloc(sizeof(struct zuozhe));
	p1=p2=head;
	for(i=0;i<26;i++)
	{
		p2=p1;
		p1=(struct zuozhe *)malloc(sizeof(struct zuozhe));
		p2->counts=0;
		p2->nam='A'+i;
		p2->next=p1;
	}
	p2->next=0;
	return head;
}
void main()
{
	int big=0;
	char zz;
	int i,j;
	char c;
	int m,n;
	int a[26]={0};
	struct worker *head1,*p1,*p2;
	struct zuozhe *head2,*q1,*q2;
	scanf("%d",&n);
	head1=creat1(n);
	p1=p2=head1;
	head2=creat2();
	q1=q2=head2;
	while(p1!=0)
	{
		i=0;
		while(p1->name1[i]!='\0')
		{
			q1=head2;
			while(1)
			{
				if(q1->nam==p1->name1[i])
				{
					q1->name[q1->counts]=p1->nm;
					q1->counts++;
					i++;
					break;
				}
				q1=q1->next;
			}
		}
		p1=p1->next;
	}
	q1=head2;
	while(q1!=0)
	{
		if(q1->counts>big)
		{
			zz=q1->nam;
			big=q1->counts;
		}
		q1=q1->next;
	}
	q1=head2;
	while(1)
	{
		if(q1->nam==zz)
		{
			printf("%c\n%d\n",q1->nam,q1->counts);
			for(i=0;i<q1->counts;i++)
			{
				printf("%d\n",q1->name[i]);
			}
			break;
		}
		q1=q1->next;
	}
}


struct Book
{
	int id;
	char author[26];
	int flag;
}book[1000];
int main()
{
	int n, i, j, l, max, maxnum;
	int num = 0;
	int a[26] = {0};
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%d %s", &book[i].id, book[i].author);
		l = strlen(book[i].author);
		for(j = 0; j < l; j++)
			a[book[i].author[j] - 65]++;

	}
	max = 0;
	maxnum = 0;
	for(i = 0; i < 26; i++)
	{
		if(a[i] > max)
		{
			max = a[i];
			maxnum = i;
		}
	}
	printf("%c\n", maxnum+65);
	for(i = 0; i < n; i++)
	{
		book[i].flag = 0;
		l = strlen(book[i].author);
		for(j = 0; j < l; j++)
			if(book[i].author[j] == maxnum+65)
			{
				num++;
				book[i].flag = 1;
				break;
			}
	}
	printf("%d\n", num);
	for(i = 0; i < n; i++)
		if(book[i].flag == 1)
			printf("%d\n", book[i].id);
	return 0;
}


struct shu
{
	char xh[100];                      /*??*/
	char zz[100];
	struct shu * next;
};

int num[26]={0},m;
struct shu *creat(int n)
{
	int i=0;
	struct shu *p1,*p2,*head;
	p1=p2=(struct shu *)malloc(sizeof(struct shu ));
    head=0;
    while(i<n)
	{
		i++;
		if(i==1)
		{
			p1->next=0;
			head=p1;
		}
		else
		{
			p2=p1;
			p1=(struct shu *)malloc(sizeof(struct shu ));
			p1->next=p2->next;
			p2->next=p1;
		}
		scanf("%s %s",p1->xh,p1->zz);
	}
	return head;
}
void max(struct shu *head)
{
	struct shu *p;
	char *f;
	int i,zd=0;
	for(p=head;p!=0;p=p->next)     /*??p++*/
	{
		for(f=p->zz;*f!='\0';f++)
		{
			num[*f-65]++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(num[i]>zd)
		{
			zd=num[i];
			m=i;
		}
	}
	printf("%c\n",65+m);
	printf("%d\n",zd);            /*???????*/
}

void print(head)
{
	struct shu *p;
	char *f;
	for(p=head;p!=0;p=p->next)                 /*????p++*/
	{
		for(f=p->zz;*f!='\0';f++)
		{
			if(*f==65+m)
			{
				printf("%s\n",p->xh);
				break;
			}
		}
	}
}

void main()
{
	int n;
	struct shu *head;
	scanf("%d",&n);
	head=creat(n);
	max(head);
    print(head);
}


struct book
{
	int num;
	char writer[30];
	struct book *next;
};
int n;
struct book *creat(void)
{
	struct book *head;
	struct book *p1,*p2;
	int m=0;
	p1=p2=(struct book*)malloc(len);
	scanf("%d %s",&p1->num,p1->writer);
	head=NULL;
	while(m<n-1)
	{
		m++;
		if(m==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book*)malloc(len);
		scanf("%d %s",&p1->num,p1->writer);
	}
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	return (head);
}
void main()
{
	scanf("%d",&n);
	struct book * head,*p1;
	head=creat();
	struct book *p;
	p=head;
	int i;
	int sum[27];
	memset(sum,0,sizeof(sum));
	char m;
    for(p=head;p!=NULL;p=p->next)
	{int x;
		for(i=0;i<strlen(p->writer);i++)
		{
			x=p->writer[i]-'A';
			sum[x]++;
		}
	}
	int max=sum[0];
	for(i=0;i<27;i++)
	{
		if(max<sum[i]) max=sum[i];
	}
	for(i=0;i<27;i++)
	{
		if(sum[i]==max) {printf("%c\n%d\n",'A'+i,sum[i]);m='A'+i;}
	}
	for(p=head;p!=NULL;p=p->next)
	{
		for(i=0;i<strlen(p->writer);i++)
		{
			if(p->writer[i]==m) {printf("%d\n",p->num);break;}
		}
	}

}


int main(int argc, char *argv[])
{
  int n,k,i=0,j,x=0;
  scanf("%d%d",&n,&k);
  int a[n];
  for(;i<=n-1;i++)
  {scanf("%d",a+i);
  for(j=0;j<=i-1;j++)
  if(a[i]+a[j]==k) {x=1;break;}
  if(x==1) {printf("yes");break;}
  }
  if(x==0) printf("no");
  return 0;
}


/*
 * qujianl.cpp
 *
 *  Created on: 2013-1-17
 *      Author: lenovo
 */

int main(){
	int a[100000]={0},n,k,x,i;
	int ifind=0;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&x);
		if(x>k)
			continue;
		if(a[x]==1){
			ifind=1;
			break;
		}
		a[k-x]=1;
	}
	if(ifind)
		printf("yes");
	else
		printf("no");
	return 0;
}


int main(){
	int sz[1100];
	int n,k,i,j,x;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&sz[i]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(i!=j)x=sz[i]+sz[j];
			 if (x==k) break;
		}
		if(x==k)break;
	}

	   if(x==k) printf("yes\n");

	if(x!=k)
		printf("no\n");
	return 0;

}


int main(){
int n,k;
int sz[1000];
int a,b,c=0;
scanf("%d %d",&n,&k);
for(int i=0;i<n;i++){
        scanf("%d",&sz[i]);
        }
for(int p=0;p<n;p++){
        for(int i=1;i<=n;i++){
                a=sz[p];
                b=sz[i];
                if(a+b==k){c+=1;
                }
                }
                }
if(c==0){printf("no");}
else printf("yes");
return 0;
    }


int main()
{
	int n,m,x=0;
	cin>>n>>m;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int k=0;k<n-1;k++)
	{
		for(int j=k+1;j<n;j++)
		{
			if(a[j]+a[k]==m)
			{
				x=1;
			}
		}
	}
	if(x==1) cout<<"yes";
	else if(x==0) cout<<"no";
	return 0;
}


void main()
{
	int n,k;
	int a[1000];
	int i,j;
	int num=0;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n-1;i++)
		for(j=i+1;j<n;j++)
			if(a[i]+a[j]==k)
				num=num+1;
			if(num==0)
				printf("no\n");
			else
				printf("yes\n");
}


int main()
{

	int i,j,a,c,e,x,b,d,h;
    int k,n;
	int m[1000],t;
	scanf("%d%d",&n,&x);
	for(i=1;i<=n;i++){
	   scanf("%d",&m[i]);
	}
	for(i=1;i<=n;i++){
		for(j=i+1;j<=n;j++){
			if(m[i]+m[j]==x)
				goto A;
			}
		}
	A:
	if(i==n+1) printf("no");
	else printf("yes");

	return 0;
}


int main(){
	int n,m,i,k,s;
	m=0;
	int sz[LEN],p[LEN];
	scanf("%d%d",&n,&k);
	for(i=0; i<n; i++){
		scanf("%d",&sz[i]);
		p[m]=sz[i];
		m++;
	}
    for(i=0;i<n;i++){
	for(m=0;m<n;m++){
	   s=sz[i]+p[m];
	   if(s==k){
	   break;
	   }
	   }
       if(s==k){
	   break;
	   }
	}
    if(i==n){
		printf("no");
	}
	else{
        printf("yes");
		}
    return 0;
}


void main()
{
	int n,a[1000],i,j,k,jud=0;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++){
		for(j=i;j<n;j++)if(a[i]+a[j]==k){jud=1;break;}
		if(jud)break;
	}
	if(jud)printf("yes");
	else printf("no");
}


int main(){
    int n,k,i,a,b,c;
    int sz[1000];
    c=0;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&(sz[i]));
    }
    for(int a=0;a<n;a++){
        for(i=0;i<n;i++){
            b=sz[a]+sz[i];
              if(sz[a]+sz[i]==k){
            c++;
              }
              else{continue;}
           }
        }
    if(c==0){
        printf("no");
      }
       if(c>0){
        printf("yes");
      }
    return 0;
}


void main()
{
 int a[1000],b,c,d,i,n,j,k;
 scanf("%d%d",&n,&k);
 for(i=0;i<n;i++)
 scanf("%d",&a[i]);
 for(i=0;i<n;i++)
 for(j=0;j<n;j++)
 if(a[i]+a[j]==k)
 {
  printf("yes\n");
 goto loop;
  }
 printf("no\n");
loop:
 b=0;
}


int main(){
int n,k;
scanf("%d%d\n",&n,&k);
int sz[NUMBER];
int i,m,q=0;
for(i=0;i<n;i++){
scanf("%d",&(sz[i]));
}
int szf[NUMBER];

for(i=0;i<n;i++){
szf[i]=k-sz[i];
}
for(m=0;m<n;m++){
for(i=0;i<n;i++){
if(szf[m]==sz[i]&&szf[m]!=sz[m]){
printf("yes");
q=1;
break;
}
}
if(q)break;
}
if(q==0){printf("no");}
return 0;
}


int main(int argc, char* argv[])
{  int i,j,n,k;
   int m=0;
	int a[1000];
   scanf("%d",&n);
   scanf("%d",&k);
   for(i=0;i<n;i++)
   scanf("%d",&a[i]);
   for(i=0;i<n;i++)
   {for(j=i+1;j<n;j++)
   {
	   if(a[i]+a[j]==k)
       m++;
   }
   }
   if(m!=0)
	   printf("yes");
   if(m==0)
	   printf("no");
   return 0;
}


int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int sz[n];
    for(int i=0;i<n;i++){
        scanf("%d",&sz[i]);
    }
    for(int i=0;i<n-1;i++){
        for(int s=i+1;s<n;s++){
            if(sz[i]+sz[s]==k){
                printf("yes");return 0;
            }
            if(sz[i]+sz[s]!=k&&i==n-2){
                printf("no");return 0;
            }
        }
    }
}


int a[999999];
int cmp(const void *a,const void *b)
{
	return (*(int *)a) - (*(int *)b);
}
int main()
{
	int n;
	int k;
	scanf("%d%d",&n,&k);
	int i,j;
	if(n==0)
	{
		cout<<"NO"<<endl;
		return 0;
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	stable_sort(a,a+n);
	//random_shuffle(a,a+n);
	//qsort(a,n,sizeof a[0],cmp);
	i=0;
	j=n-1;
	while(i!=j)
	{
		if(a[i]+a[j]>k)
		{
			j--;
			continue;
		}
		else if(a[i]+a[j]<k)
		{
			i++;
			continue;
		}
		else
		{
			printf("%s","yes");
			//cout<<"YES"<<endl;
			return 0;
		}
	}
	printf("%s","no");
	//cout<<"NO"<<endl;
	return 0;
}


int main(int argc, char* argv[])
{
	int n,i,j,k,s;
	int a[1000],flag=0;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		s=k-a[i];
		for(j=i+1;j<n;j++)
		{
			if(s==a[j]){
				flag=1;
				break;
			}
		}
	}
	if(flag){
		printf("yes\n");
	}
	else{
		printf("no\n");
	}
	return 0;
}


int main(){
	int array[1000],n,k,i,j,flag=0,m;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&array[i]);
	}

	for(i=0;i<n-1;i++){
			m=i;
			for(j=i+1;j<n;j++){
				if(array[j]<array[m]){
					m=j;
				}
			}
			int temp=array[i];
			array[i]=array[m];
			array[m]=temp;
	}

	for(i=0,j=n-1;i<j;){
		int temp=array[i]+array[j];
		if(temp==k){
			flag=1;
			break;
		}else if(temp>k){
			j--;
		}else{
			i++;
		}
	}
	if(flag){
		printf("yes");
	}else{
		printf("no");
	}
	return 0;
}


int main(){
    int a[1000];
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);

    }for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            if(a[i]+a[j]==k){printf("yes");
            return 0;}
        }
    }printf("no");
    return 0;

}


int ex(int *x,int *y){
    int tmp=0;
    tmp=*x;
    *x=*y;
    *y=tmp;
    }
int main(){
    int n,k;
    int s=0;
    int sz[1000];
    scanf("%d%d",&n,&k);
    for(int a=0;a<n;a++){
            scanf("%d",&(sz[a]));
            }
    for(int b=0;b<n;b++){
            for(int c=b+1;c<n;c++){
                    if((sz[c])+(sz[b])==k){
                                        s++;
                                        }
                    }
            }
    if(s==0){
             printf("no");
             }else{
    printf("yes");}

    return 0;
    }


int main(){
 int sz[SUM];
 int n,k;
 scanf("%d%d",&n,&k);
 int i;
 for(i=0;i<n;i++){
                  scanf("%d",&sz[i]);
                  }
 int j,sum=0;
 for(j=0;j<n-1;j++){
                  for(i=1;i<=n-j-1;i++){
                                      if(sz[j]+sz[j+i]==k){
                                                           sum++;
                                                           }
                                      }
                  }
 if(sum!=0){
            printf("yes");
            }
 else{
      printf("no");
      }

 return 0;
}


int main()
{
int n,k,i,j;
scanf("%d%d",&n,&k);
int a[n];
char p;
for(i=0;i<n;i++)
{
    scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
    for(j=1;j<n;j++)
    {
        if(a[i]+a[j]==k)
        {
            p='y';
            printf("yes");
            break;
        }
        else
        continue;
        }
    if(p=='y')
    break;
    else
    continue;
}
if(p=='y')
return 0;
else
printf("no");
return 0;
}


int main(){
	int a[1000];
	int b,i,n,k,j,s;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		s=a[i];
		for(j=i+1;j<n;j++){
			s=a[i]+a[j];
			if(s==k){
				b=1;
			}
			else
				continue;
		}
	}
	if(b==1)
		printf("yes");
        else
		printf("no");
	return 0;
}


int main(){
	int n,k;
	int sz[1000];
	scanf("%d%d",&n,&k);
	int i;
	i=0;
	while(i<n){
	scanf("%d",&sz[i]);
	i++;
	}
	int f=0;
	int sum;
	for(i=0;i<n;i++){
		for(int t=0;t<n;t++){
			sum=sz[i]+sz[t];
			if(sum==k){
				f=1;
				break;
			}
		}
	}
	if(f==1){
		printf("yes");
	}else{
		printf("no");
	}
	return 0;
}


void main()
{
	int n,k,m=0;
	int a[1000];
	int i,j;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
		for(j=1;j<n-i;j++)
			if(a[i]+a[i+j]==k)
				m++;

    if(m)
		printf("yes");
	else
		printf("no");

}


void main()
{
	int n,k;
	int *p;
	scanf("%d%d",&n,&k);
	p=(int *)malloc(sizeof(int)*n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%d",(p+i));
	}
	int judge=0;
	int j;
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(*(p+i)+*(p+j)==k)
			{
				judge=1;
				break;
			}
		}
		if(judge)
			break;
	}
	if(judge)
		printf("yes");
	else
		printf("no");
}


int main()
{
	int n,k,i,j;
	scanf("%d %d",&n,&k);
	int a[1000];
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int hh=0,b=0;
	for(i=0;i<n;i++){
		int count=0;
		for(j=i+1;j<n;j++){
			if(a[i]+a[j]==k){
				printf("yes");
				b=1;
				break;
			}
			else  count++;
		}
		if(b==1) break;
		if(count==n-1-i) hh++;
	}
	if(hh==n) printf("no");
	return 0;
}


int main()
{
    int sz[1000];
    int n,k;
    int i,j;
    int sum,a=0;
    scanf("%d%d\n",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",&sz[i]);
    }
    for(j=0;j<n;j++){
        if(a==1){
            break;
        }else{
        for(i=0;i<n;i++){
            sum=sz[j]+sz[i];
            if((sum==k)&&(i!=j)){
                a=1;
                break;
            }else{
                continue;
            }
         }
        }
    }
    if(a==1){
        printf("yes");
    }else{
        printf("no");
    }
    return 0;

}


void main()
{
	int n,k;
	int a[1001];
	int i,j;
	int flag=0;

	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n&&flag==0;i++)
		for(j=0;j<n&&flag==0;j++)
		{
			if(j>i&&a[i]+a[j]==k)
			{
				printf("yes\n");
				flag=1;
			}
		}
	if(flag==0)
		printf("no");
}


int main()
{
	int a[1000],n,k,i,j,l,m;
	scanf("%d",&n);
	scanf("%d",&k);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	l=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			if(j==i)
				continue;
			else
			{
				m=a[i]+a[j];
				if(m==k)
				{
					l++;
					break;
				}
			}
		}
		if(l>0)
			break;
	}
	if(l==0)
		printf("no");
	else
		printf("yes");
	return 0;
}


int main()
{
	int a[1000];
	int n,i,j,k;
	int t;
	int d;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		t=k-a[i];
		for(j=i;j<n;j++)
		{
			if(a[j]==t){printf("yes\n");return 0;}
		}

	}
	printf("no");
	return 0;

}


int main()
{
    int i,j,k,n,a[1000];

	scanf("%d%d",&n,&k);
	for (i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}

	int flag;
	for (i=0;i<n;i++)
	{
		flag=0;
		for (j=0;j<n;j++)
		{
			if (k==a[i]+a[j])
			{
				flag=1;break;
		}}

		if (flag)
		{
			break;
		}
	}
	if (flag)
	{
		printf("yes");

	}
	else
		printf("no");
	return 0;

}


int main()
{
	int n, k, i, a[1000], j, q;
	scanf("%d%d", &n, &k);
	for (i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			q = a[i] + a[j];
			if (q == k)
				break;
			else
				q = 0;
		}
		if (q == k)
			break;
	}
	if (q == k)
		printf("yes");
	else
		printf("no");
	return 0;
}


int main()
{
    int n,i,k,num;
    int a[N],b[N];
    scanf("%d%d",&n,&num);

    for(i=0;i<n;i++)
   {
       scanf("%d",&(a[i]));
   }
   for(k=0;k<n-1;k++)
   {
       for(i=1;i<n-k;i++)
       {
           if(a[k]+a[k+i]==num)
           {
              goto done;
           }
       }

   }

   done:if(k>=n-1)
        {
            printf("no");
        }
        else
        {
             printf("yes");
        }
    return 0;
}


int main(int argc, char* argv[])
{
int n,k,a,h;
int sz[1000];
h=0;
scanf("%d %d",&n,&k);
for(int i=0;i<n;i++){
   scanf("%d ",&sz[i]);
}
for(int j=0;j<n;j++){
	for(int r=0;r<n;r++){
		a=sz[j]+sz[r];
		if(a!=k){
		   h++;
		}

	}
}
if(h==n*n){
	printf("no");
}else{
	printf("yes");
}

	return 0;
}