int main()
{
int suffix(char a[]);
char a[50][32];
int n,i,l,j,p;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%s",a[i]);
p=suffix(a[i]);
l=strlen(a[i]);
for(j=0;j<l-p;j++)printf("%c",a[i][j]);
printf("\n");
}
}
int suffix(char a[])
{
	int l,p;
	l=strlen(a);
	switch(a[l-1])
	{case 'g':p=3;break;
	 case 'r':p=2;break;
	 default :p=2;}
	return(p);
}


int main()
{
	int n;
	char word[33];
	char suffix[4];
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> word;
		int len = strlen(word);
		if (word[len - 1] == 'r' && word[len - 2] == 'e')
		{
			word[len - 2] = '\0';
			cout << word << endl;
		}
		else if (word[len - 1] == 'y' && word[len - 2] == 'l')
		{
			word[len - 2] = '\0';
			cout << word << endl;
		}
		else if (word[len - 1] == 'g' && word[len - 2] == 'n' && word[len - 3] == 'i')
		{
			word[len - 3] = '\0';
			cout << word << endl;
		}
		else
		{
			cout << word << endl;
		}
	}
	return 0;
}


void main ()
{
	int n;
	int len;

	scanf("%d",&n);
	getchar();

	for(;n>0;n--)
	{
		char str[100];

		gets(str);
		len=strlen(str);

		if(str[len-1]=='g') str[len-3]='\0';
		else str[len-2]='\0';

		puts(str);
	}
}


void main()
{
    int m,n,i,j=0;
    char string[100];
    scanf("%d",&n);
    for(i=0;i<=n;i++)
    {
    	gets(string);
    	m=strlen(string);
    	for(j=0;j<m;)
    	j++;
    		if(string[m-1]=='r'||string[m-1]=='y')
    			m=m-2;
    		if(string[m-1]=='g')
    		    m=m-3;
    		    for(j=0;j<m;j++)
    			printf("%c",string[j]);
    			printf("\n");
    }
}


int main(){
	int n,i,l;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		char word[max+1];
		scanf("%s",word);
		l=strlen(word);
		if(strcmp(&word[l-1],"r")==0){
			word[l-2]=word[l-2]-'e'+'\0';
		}
		else if(strcmp(&word[l-1],"y")==0){
			word[l-2]=word[l-2]-'l'+'\0';
		}
		else if(strcmp(&word[l-1],"g")==0){
			word[l-3]=word[l-3]-'i'+'\0';
		}
		printf("%s\n",word);
	}
	return 0;
}


int main()
{
	char a[100];
int n,i;
char *p;
scanf("%d",&n);
getchar();
for(i=0;i<n;i++)
{

	gets(a);
	p=a+strlen(a)-1;
	if(*p=='r'){for(p=a;p<a+strlen(a)-2;p++)printf("%c",*p);}
	else if(*p=='y'){for(p=a;p<a+strlen(a)-2;p++)printf("%c",*p);}
	else if(*p=='g'){for(p=a;p<a+strlen(a)-3;p++)printf("%c",*p);}
	printf("\n");
}
return 0;
}


int main()
{
	int n,i,j,len;
	char word[33];
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%s",word);
		len=strlen(word);
		if(word[len-1]=='r')
		{
			for(i=0;i<len-2;i++)
				printf("%c",word[i]);
		}
		else if(word[len-1]=='y')
		{
			for(i=0;i<len-2;i++)
				printf("%c",word[i]);
		}
		else
		{
			for(i=0;i<len-3;i++)
				printf("%c",word[i]);
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n;int len;
	scanf("%d",&n);
	struct zfc
	{
		char zifu[20];
	};
	struct zfc line[50];
    int i;
	for(i=0;i<=n-1;i++)
		scanf("%s",line[i].zifu);
	for(i=0;i<=n-1;i++)
	{
	    len=strlen(line[i].zifu);
	    if(line[i].zifu[len-1]=='r'&&line[i].zifu[len-2]=='e')
		{line[i].zifu[len-1]='\0';line[i].zifu[len-2]='\0';
		printf("%s\n",line[i].zifu);
		}

		else if(line[i].zifu[len-1]=='y'&&line[i].zifu[len-2]=='l')
		{
		line[i].zifu[len-1]='\0';line[i].zifu[len-2]='\0';
		printf("%s\n",line[i].zifu);
		}
		else if(line[i].zifu[len-1]=='g'&&line[i].zifu[len-2]=='n'&&line[i].zifu[len-3]=='i')
		{
			line[i].zifu[len-1]='\0';line[i].zifu[len-2]='\0';line[i].zifu[len-3]='\0';
			printf("%s\n",line[i].zifu);

		}
		else printf("%s",line[i].zifu);
	}
	return 0;
}


int main()
{
	int n,i,number;
	char str1[33];
	scanf("%d",&n);
	for(i=0,number=0;i<n;i++)
	{
		scanf("%s",str1);
		number=strlen(str1);
		if(str1[number-1]=='r')
		{
			str1[number-2]='\0';
			printf("%s\n",str1);
		}
		else
			if(str1[number-1]=='y')
			{
				str1[number-2]='\0';
				printf("%s\n",str1);
			}
			else
				if(str1[number-1]=='g')
				{
					str1[number-3]='\0';
					printf("%s\n",str1);
				}
	}
}


char key[3][4]={"er","ly","ing"};
char name[50];
char get[3];
char get3[3];
int main(){
	int n;
	cin>>n;
	int len;
	for(int i=0;i<n;i++){
		cin>>name;
		len = strlen(name);
		for(int j=len-3;j<len;j++){
			get3[j-len+3] = name[j];
			}
		for(int j = len - 2;j<len;j++){
			get[j-len+2] = name[j];
			}
		if(strcmp(get,key[0])==0||strcmp(get,key[1])==0){
			for(int j = 0;j<len-2;j++){
				cout<<name[j];
				}
			cout<<endl;
			continue;
			}
		if(strcmp(get3,key[2])==0){
			for(int j = 0;j<len-3;j++){
				cout<<name[j];
				}
			cout<<endl;
			continue;
			}
		}
	return 0;
	}


int main()
{
	void cut1(char a[],int b);
	void cut2(char a[],int b);
	char word[32];
	int n,i,a,j;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		for(j=0;j<=31;j++)
		word[j]='\0';
		scanf("%s",word);
		a=strlen(word);
		if(word[a-3]=='i')
			cut1(word,a);
		if(word[a-2]=='l'||word[a-2]=='e')
			cut2(word,a);
		printf("%s\n",word);
	}
	return 0;
}
void cut1(char a[],int b)
{
	a[b-3]='\0';
}
void cut2(char a[],int b)
{
    a[b-2]='\0';
}


int main()
{
	char word[32],n,i,j,k,len,temp[32];
	scanf("%d\n",&n);
	for (i=1;i<=n;i++)
	{
		gets(word);
		len=strlen(word);
		for (j=len-2;j<=len;j++) temp[j-len+2]=word[j];
		if (strcmp(temp,"er")==0 || strcmp(temp,"ly")==0)
		{
			word[len-2]='\0';
			printf("%s\n",word);
		}
		for (j=len-3;j<=len;j++) temp[j-len+3]=word[j];
		if (strcmp(temp,"ing")==0)
		{
			word[len-3]='\0';
			printf("%s\n",word);
		}
	}
	return 0;
}


int main(){
	int n,suffixlen;
	char word[40],*p;
	scanf("%d", &n);
	for(int i =0; i<n; i++){
		scanf("%s", word);
		for(p = word;*p;p++);
		switch(*(p-1))
		{
			case'r':suffixlen = 2;break;
			case'y':suffixlen = 2;break;
			case'g':suffixlen = 3;break;
		}
		*(p-suffixlen) ='\0';
		printf("%s\n",word);
	}
		return 0;
}


int main()
{
	char word[50][50];
	int n, i, len, j, out[50];
	scanf("%d", &n);
	for (i=1;i<=n;i++){
		scanf("%s", &word[i]);
		len = strlen(word[i]);
		if (word[i][len-1] == 'r')
			out[i] = 1;
		else if (word[i][len-1] == 'y')
			out[i] = 2;
		else if (word[i][len-1] == 'g')
			out[i] = 3;
	}
	for (i=1;i<=n;i++){
		len = strlen(word[i]);
		if (out[i] == 1 || out[i] == 2){
			word[i][len-2] = 0;
			word[i][len-1] = 0;
			printf("%s", word[i]);
		}
		if (out[i] == 3){
			word[i][len-3] = 0;
			word[i][len-2] = 0;
			word[i][len-1] = 0;
			printf("%s", word[i]);
		}
		printf("\n");
	}
	return 0;
}


int main(){

	char danCi[N][LEN];

	int n, i, len;

	scanf("%d", &n);

	for(i = 0; i < n; i++){
		scanf("%s", danCi[i]);
	}

	for(i = 0; i < n; i++){
		len = strlen(danCi[i]);

		if((danCi[i][len - 1] == 'r') || (danCi[i][len - 1] == 'y')){
			danCi[i][len - 2] = 0;
		}else{
			danCi[i][len - 3] = 0;
		}

	}

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

	return 0;
}


int main()
{
	int n, i, j, lenth[50];
	char word[50][35];
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{scanf("%s",word[i]);}

	for(i=0;i<n;i++)
	{lenth[i]=strlen(word[i]);

	if(word[i][lenth[i]-1]=='g')
	{
	for(j=0;j<lenth[i]-3;j++)
	{printf("%c",word[i][j]);}
	printf("\n");
	}

	else if(word[i][lenth[i]-1]=='y')
		{
		for(j=0;j<lenth[i]-2;j++)
		{printf("%c",word[i][j]);}
		printf("\n");
		}
	else if("%c",word[i][lenth[i]-1]=='r')
		{
		for(j=0;j<lenth[i]-2;j++)
		{printf("%c",word[i][j]);}
		printf("\n");
		}
	}

		return 0;
	}


int main(int argc, char* argv[])
{
	int n,i,j,k,length;
	scanf("%d",&n);
	for (k=0;k<n;k++)
	{
		char str[50];
		char daoz[50]={0};
		scanf("%s",str);
		length=strlen(str);
		for (i=length-1,j=0;i>=length-2;i--,j++)
		{
			daoz[j]=str[i];

		}

		if(strcmp(daoz,"re")==0)
		{
			for (i=0;i<=length-3;i++)
			{
				printf("%c",str[i]);
			}
			printf("\n");
		}
		if(strcmp(daoz,"yl")==0)
		{
			for (i=0;i<=length-3;i++)
			{
				printf("%c",str[i]);
			}
			printf("\n");
		}
		for (i=length-1,j=0;i>=length-3;i--,j++)
		{
			daoz[j]=str[i];

		}

		if(strcmp(daoz,"gni")==0)
		{
			for (i=0;i<=length-4;i++)
			{
				printf("%c",str[i]);
			}
			printf("\n");
		}

	}
return 0;
}


char key[3][10] = {"er", "ly", "ing"};

int main()
{
	int n;
	int l;
	char *p;
	char c[50];

	cin >> n;

	while(n --)
	{
		cin >> c;

		l = strlen(c);

		p = c + l - 2;

		if(strcmp(p, key[0]) == 0 || strcmp(p, key[1]) == 0)
			*p = 0;
		else
			*(p - 1) = 0;

		cout << c << endl;
	}

}


main()
{
      int n,i,len;
      scanf("%d",&n);

      for(i=0;i<n;i++)
      {
          char letter[51]={'\0'};
          scanf("%s",letter);
          len=strlen(letter);
          if(letter[len-2]=='e'||letter[len-2]=='l')
              letter[len-2]='\0';
          if(letter[len-2]=='n')
              letter[len-3]='\0';
          printf("%s\n",letter);
          }
}


int main(){
	char words[N][len];
	int n,i,l;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",words[i]);
		l=strlen(words[i]);
		if(words[i][l-1]=='r'||words[i][l-1]=='y'){
			words[i][l-2]=0;
			printf("%s\n",words[i]);
		}else{
			words[i][l-3]=0;
			printf("%s\n",words[i]);
		}
	}
	return 0;
}


void main()
{
	int n,i;
	char str[15];
    void change(char str[15]);
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",str);
		change(str);
	}
}

	void change(char strr[15])
	{
		char cutstr[13]={""},mstr[15]={""};
		int length;
		length=strlen(strr);
		strncpy(mstr,strr,length-2);
		strcat(mstr,"ly");
		if(strcmp(mstr,strr)>=0)
		{
			strncpy(cutstr,strr,length-2);
		}
		else
		{
			strncpy(cutstr,strr,length-3);
		}
		printf("%s\n",cutstr);
	}


main()
{int i,j,k,m,n;
 int pd(char p[33]);
 scanf("%d",&n);
 char dc[n][33];
 for(i=0;i<n;i++)
  scanf("%s",dc[i]);
 for(i=0;i<n;i++)
  {m=strlen(dc[i]);
   if(pd(dc[i])==1)
     {for(j=0;j<(m-3);j++)
        printf("%c",dc[i][j]);
     }
   else
     {for(j=0;j<(m-2);j++)
   printf("%c",dc[i][j]);
     }
   printf("\n");
  }

}
int pd(char p[33])
{int t=strlen(p);
 if (p[t-1]=='g') return (1);
 else return(0);
}


int main(){
    int n,i,j;
    char word[53][35],del[53][35];
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%s",word[i]);
        if(word[i][strlen(word[i])-1]=='r'){
            for(j=0;j<strlen(word[i])-2;j++)
                del[i][j]=word[i][j];
        }else
        if(word[i][strlen(word[i])-1]=='y'){
            for(j=0;j<strlen(word[i])-2;j++)
                del[i][j]=word[i][j];
        }else
        if(word[i][strlen(word[i])-1]=='g'){
            for(j=0;j<strlen(word[i])-3;j++)
                del[i][j]=word[i][j];
        }
    }

    for(i=0;i<n;i++)
        puts(del[i]);

    return 0;
}


int main(){
	char x[2],word[32];
	int i,j,k,len,n;
	gets(x);
	n=atoi(x);
	for (i=0;i<n;i++){
		gets(word);
		len=strlen(word);
		if(word[len-1]=='g'){
			for(j=0;j<len-3;j++)
				printf("%c",word[j]);
			printf("\n");
		}
		else {
			for (k=0;k<len-2;k++)
				printf("%c",word[k]);
			printf("\n");
		}
	}
	return 0;
}


void main()
{
	char str[15];
	int n,i,j,l;
	scanf("%d",&n);
        gets(str);
	for(i=0;i<n;i++)
	{
		gets(str);
		l=strlen(str);
		if(str[l-1]=='g')
		{
			for(j=0;j<l-3;j++)
			printf("%c",str[j]);
		}
		else
		{
			for(j=0;j<l-2;j++)
			printf("%c",str[j]);
		}
		printf("\n");
	}
}


void main()
{
	int n,i,num;
	scanf("%d\n",&n);
	char str[100];
    for(i=0;i<n;i++)
	{   gets(str);
	    num=strlen(str);
		num=num-1;
		if(str[num]=='r')str[(num-1)]='\0';
		if(str[num]=='y')str[(num-1)]='\0';
		if(str[num]=='g')str[(num-2)]='\0';
		puts(str);
	}
}


void main()
{
	int i,n,len;
	char word[100][20],d;
	scanf("%d",&n);  d=getchar();
	for(i=0;i<n;i++)
	{
		gets(word[i]);
		d=getchar;
	}
	for(i=0;i<n;i++)
	{
		len=strlen(word[i]);
		if(word[i][len-1]=='r'||word[i][len-1]=='y')
		{
			word[i][len-2]='\0';
			printf("%s\n",word[i]);
		}
		else
		{
			word[i][len-3]='\0';
			printf("%s\n",word[i]);
		}
	}
}


int main() {
	char word[100];
	int n,len;
	scanf("%d",&n);
	while(n--){
		scanf("%s",word);
		len=strlen(word);
		if(word[len-1]=='r' || word[len-1]=='y'){
				word[len-2]='\0';
		} else if(word[len-1]=='g'){
			word[len-3]='\0';
		}
	printf("%s\n",word);
	}
	return 0;
}


int cutsign(char s[],int len)
{
	if(s[len-1]=='y'||s[len-1]=='r')return len-2;
	else return len-3;
}
int main()
{
	int n,i,j,sign[50];
	char s[50][15];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s",s[i]);
	sign[i]=cutsign(s[i],strlen(s[i]));
	}
	for(i=0;i<n;i++)
	{for(j=0;j<sign[i];j++)
			printf("%c",s[i][j]);
	printf("\n");
	}
	return 0;
}


int main()
{
	int n,i,j,length[SIZE];
	char word[SIZE][SIZE2];
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		gets(word[i]);
	}
	for(i=0;i<n;i++)
	{
		length[i]=strlen(word[i]);
		if(word[i][length[i]-1]=='r'||word[i][length[i]-1]=='y')
		{
			for(j=0;j<length[i]-2;j++)
			{
				printf("%c",word[i][j]);
			}
			printf("\n");
		}
		else if(word[i][length[i]-1]=='g')
		{
			for(j=0;j<length[i]-3;j++)
			{
				printf("%c",word[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}


void main()
{
	char str[51][10];
	int n,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str[i]);
		if(str[i][strlen(str[i])-1]=='y'||str[i][strlen(str[i])-1]=='r')
			str[i][strlen(str[i])-2]='\0';
		else str[i][strlen(str[i])-3]='\0';
	}
	for(i=0;i<n;i++)
		printf("%s\n",str[i]);
}


int main()
{
	char str[MAX][20];
	int i,length,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str[i]);
	}
	for(i=0;i<n;i++){
		length=strlen(str[i]);
		if(str[i][length-1]=='g'){
			str[i][length-3]='\0';
		}
		else
			str[i][length-2]='\0';

		printf("%s\n",str[i]);
	}
	return 0;
}


int main(){
	char former[50];
	int n,j,i;
	int q[50];
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		gets(former);
		q[i]=strlen(former);
		if(former[q[i]-1]=='y'||former[q[i]-1]=='r')
		{
			for(j=0;j<q[i]-2;j++)
				printf("%c",former[j]);
		}
	    if(former[q[i]-1]=='g')
		{
			for(j=0;j<q[i]-3;j++)
				printf("%c",former[j]);
		}
		if(i!=0&&i!=n)
			printf("\n");
	}
	return 0;
}


char eng[60][35]={0};
int i;

void main()
{
	void change(int i);
	int sum;
	scanf("%d",&sum);
	for(i=0;i<sum;i++)
	{
		scanf("%s",&eng[i]);
	}
	for(i=0;i<sum;i++){
		change(i);
	}
	for(i=0;i<sum;i++)
		printf("%s\n",eng[i]);
}

void change(int i)
{
	int a;
	a=strlen(eng[i]);
	if(eng[i][a-2]=='e'||eng[i][a-2]=='l')
	{
		eng[i][a-2]='\0';
	}
	else if(eng[i][a-3]=='i')
	{
		eng[i][a-3]='\0';
	}

}


int f(char a[],int la,char p[],int lp)
{
    int m=la-1,n=lp-1;
    if(la<lp) return 0;
    while((n>=0)&&(a[m]==p[n]))
    {m--;n--;}
    if(n<0) return 1;
    else return 0;
}

void g(char a[],int l,int k)
{
    a[l-k]=0;
}

void main()
{
    int count,i,j,l,k,c[3]={2,2,3};
    char a[33],b[3][4]={"er","ly","ing"};
    scanf("%d",&count);
    getchar();
    for(i=0;i<count;i++)
    {
       scanf("%s",a);
       l=strlen(a);
       k=0;
       while((k<3)&&(f(a,l,b[k],c[k])==0)) k++;
       if(k<3) g(a,l,c[k]);
       puts(a);
    }
}


int main()
{
	int n,i,len;
	char *p;
	char str[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str);
		len=strlen(str);
		p=&str[len-1];
		if(*p=='g')
		{
			p=&str[len-3];
			*p='\0';
			printf("%s\n",str);
		}
		else
		{
            p=&str[len-2];
			*p='\0';
			printf("%s\n",str);
		}
	}
	return 0;
}


main()
{
     int n;
     scanf("%d",&n);
     for(int i=1;i<=n;i++)
     {
          char word[33];
          scanf("%s",word);
          int len;
          len=strlen(word);
          if(word[len-2]=='e'&&word[len-1]=='r')
          {
                for(int j=0;j<len-2;j++)
                    printf("%c",word[j]);
                printf("\n");
          }
if(word[len-2]=='l'&&word[len-1]=='y')
          {
                for(int j=0;j<len-2;j++)
                    printf("%c",word[j]);
 printf("\n");

          }
if(word[len-3]=='i'&&word[len-2]=='n'&&word[len-1]=='g')
          {
                for(int j=0;j<len-3;j++)
                    printf("%c",word[j]);
 printf("\n");

          }
}
}


int main()
{
	int n;
	scanf("%d",&n);
	char word[1000];
	int i;
	for (i=0; i<n; i++)
	{
		scanf("%s",word);
		int len=strlen(word);
		switch (word[len-1]){
			case 'r':
				if (word[len-2]=='e') word[len-2]='\0';
				break;
			case 'y':
				if (word[len-2]=='l') word[len-2]='\0';
				break;
			case 'g':
				if (word[len-2]=='n'&&word[len-3]=='i') word[len-3]='\0';
				break;
		}
		printf("%s\n",word);
	}

	return 0;
}


int main(int argc, char* argv[])
{
	int i,n;
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		int j,m;
		char s[100];
		scanf("%s",s);
		m=strlen(s);
		if(s[m-1]=='r'||s[m-1]=='y')
		{
		for(j=0;j<m-2;j++)
		{
			printf("%c",s[j]);
		}
		printf("\n");
		}
		else
        {
		for(j=0;j<m-3;j++)
		{
			printf("%c",s[j]);
		}
        printf("\n");
		}
	}
	return 0;
}


int main(){
	int n,i,j,count,check=1;
	char word[81];
	scanf("%d",&n);
	gets(word);
	for(i=0;i<n;i++){
		check=1;
		gets(word);
		count=strlen(word);
		for(j=0;j<count;j++){
			if(word[j]==' '||word[j]=='.'||word[j]=='+'||word[j]=='-'||word[j]=='/'||word[j]=='=')
				check=0;
		}
		if(check){
			if(word[0]=='_'||(word[0]>='a'&&word[0]<='z')||(word[0]>='A'&&word[0]<='Z')){
				printf("1\n");
			}
			else
			printf("0\n");
		}
		else
		printf("0\n");

	}

	return 0;
}


int main()
{
	int panduan(char *z,int len);
	int i,n,len;
	char zifu[82],*z=zifu;
	gets(zifu);
	n=atoi(zifu);
	for(i=0;i<n;i++){
		gets(zifu);
		len=strlen(zifu);
		printf("%d\n",panduan(z,len));
	}
	return 0;
}
int panduan(char *z,int len)
{
	int i;
	for(i=0;i<len;i++){
		if(i==0){
			if(*z!='_'&&(*z>'z'||*z<'a')&&(*z>'Z'||*z<'A'))
				return 0;
		}
		else{
			if(*(z+i)!='_'&&(*(z+i)>'z'||*(z+i)<'a')&&(*(z+i)>'Z'||*(z+i)<'A')&&(*(z+i)>'9'||*(z+i)<'0'))
				return 0;
		}
	}
	return 1;
}


main()
{
      int n;
      scanf("%d",&n);getchar();
      for(;n>0;n--)
      {
      int i=0;
         char str[88];
       for(i=0;i<88;i++)
       {
           str[i]='a';
       }
       gets(str);
       //scanf("%s",str);

       for(i=0;i<strlen(str);i++)
       {
             if((!isalnum(str[i]))&&str[i]!='_')
             {
                 printf("%d\n",0);
                 goto hhh;
             }
       }
         //printf("%c",str[0]);
        //char a=str[0];
        //if((str[0]<="z"&&str[0]>="a")||(str[0]<="Z"&&str[0]>="A")||str[0]=="_")
        if(isalpha(str[0])||str[0]=='_')
            {
                printf("%d\n",1);
            }
         else
            {
                printf("%d\n",0);
            }   hhh:;
      }/*getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar(); */
}


int main()
{
	int n;
	cin >> n;
	cin.get();
	char word[81];
	int j, i;
	for (i = 1;i <= n; i++)
	{
		cin.getline(word, 81);
		int flag = 0;
		if (word[0] != '_' && (word[0] < 'a' || word[0] > 'z') && (word[0] < 'A' || word[0] > 'Z'))
		{
			cout << flag << endl;
		}
		else
		{
			for (j = 0; word[j] != '\0'; j++)
			{
				if (word[j] == '_' || (word[j] >= 'a' && word[j] <= 'z') || (word[j] >= 'A' && word[j] <= 'Z') || (word[j] >= '0' && word[j] <= '9'))
					continue;
				else
				{

					break;
				}
			}
			if (word[j] == '\0')
				flag = 1;
			cout << flag << endl;
		}
		cin.clear();
	}
	return 0;
}


void main()
{
    char origin_string[81];
    int n,i,j,length;
    int check=0;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        gets(origin_string);
        length=strlen(origin_string);
        if(origin_string[0]=='_'||(origin_string[0]>='A'&&origin_string[0]<='Z')||(origin_string[0]>='a'&&origin_string[0]<='z'))
		{
			check=1;
		}
        else
		{
			check=0;
		}
        for(j=1;j<length;j++)
        {
            if(check==1)
            {
				if(origin_string[j]==' ')
				{
				      check=0;
					  break;
				}

	            if(origin_string[j]=='_'||(origin_string[j]>='A'&&origin_string[j]<='Z')||(origin_string[j]>='a'&&origin_string[j]<='z')||(origin_string[j]>='0'&&origin_string[j]<='9'))
				{
					check=1;
				}
				else
				{
				    check=0;
					break;
				}
			}
        }
        printf("%d\n",check);
    }
}


void main()
{
	int n,i,result=0;
	char c;

	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
		c=getchar();
		if(!(c=='_'||isalpha(c))){
			printf("%d\n",result);
			while(getchar()!='\n');
			continue;
		}

		while(1){
			if(!(c=='_'||isalnum(c))){
				result=0;
				while(getchar()!='\n');
				break;
			}
			else result=1;
			if((c=getchar())=='\n') break;
		}
		printf("%d\n",result);
		result=0;
	}
}


int panduan(char a){
	int result=0;
	if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||(a>='0'&&a<='9')||(a=='_'))
		 result=1;
	return result;
}
int first(char b){
	int result=0;
	if((b>='a'&&b<='z')||(b>='A'&&b<='Z')||(b=='_'))
		result=1;
	return result;
}
int main(int argc, char* argv[])
{
	int i,n,j,len,flag;
	int panduan(char a);
	int first(char b);
	char s[81];
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		gets(s);
		len=strlen(s);
		flag=1;
		if(first(*s)==0)
			flag=0;
		else if(first(*s)==1){
			for(j=1;j<len;j++){
				if(panduan(*(s+j))==0){
				flag=0;
				break;
				}
			}
		}
		if(flag==1){
			printf("1\n");
		}
		else{
			printf("0\n");
		}
	}
	return 0;
}


int main()
{
	int n, i, j, len,count;
	char word[81];
	cin >> n;
	cin.get();
	for ( i = 0; i < n; i ++ )
	{
		cin.getline(word,81);
		len = strlen(word);
		if ( word[0] == '_' || (word[0] >= 'A' && word[0] <= 'Z') || (word[0] >='a'&& word[0] <= 'z'))
		{
			count = 1;
			for ( j = 1; j < len; j ++ )
			{

				if ( word[j] == '_' || (word[j] >= 'A' && word[j] <= 'Z') || (word[j] >='a'&& word[j] <= 'z') || (word[j]<='9' && word[j] >='0') )
				count ++;
			}
			if ( count == len )
				cout << 1 << endl;
			else
				cout << 0 << endl;
		}
		else
			cout << 0 << endl;
		cin.clear();
	}
	return 0;
}


int first_test(char a);
int test(char a);
int main()
{
	char a[101][85];
	int n,i,j,l;
	int final;
	cin>>n;
	cin.get();
	for(i=1;i<=n;i++)
	{
		cin.getline(a[i],85,'\n');
		l=strlen(a[i]);
		final=first_test(a[i][0]);
		for(j=1;j<l;j++) final=final*test(a[i][j]);
		cout<<final<<endl;
	}
	return 0;
}
int first_test(char a)
{
	if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||a=='_') return (1);
	else return (0);
}
int test(char a)
{
	if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||a=='_'||(a>='0'&&a<='9')) return (1);
	else return (0);
}


void fun(char data[])
{
     int len = strlen(data);
     int i;
     int ya;

     ya = ( *data == '_' || (*data >= 'A' && *data <= 'z') );

     for(i = 1; i <= len - 1; i++)
           if(!alphabet && !number)
                     ya = 0;

     printf("%d\n", ya);
}

int main()
{
    int n;
    scanf("%d\n", &n);
    int i;
    char data[81];

    for(i = 1; i <= n; i++)
    {
          gets(data);
          fun(data);
    }

    return 0;
}


int Judge(char c)
{
	int i, flag = 0;
	for (i = 0; i < 26; i ++)
		if (c == 'a' + i || c == 'A' + i)
		{
			flag = 1;
			break;
		}
	for (i = 0; i < 10; i ++)
		if (c - '0' == i)
		{
			flag = 1;
			break;
		}
	if (c == '_')
		flag = 1;
	return flag;

}

int main()
{
	int n, i, j, l, k;
	char a[81];
	cin >> n;
	cin.get();
	for (i = 0; i < n; i ++)
	{
		cin.getline(a, 81);
		l = strlen(a);
		for (j = 0; j < l; j ++)
			if (!Judge(a[j]))
			{
				cout << 0 << endl;
				break;
			}
		if (j == l)
		{
			for (k = 0; k < 10; k ++)
				if (a[0] - '0' == k)
				{
					cout << 0 << endl;
					break;
				}
			if (k == 10)
				cout << 1 << endl;
		}
	}
	return 0;
}


int main()
{
    int n=0,i=0,len=0;
    scanf("%d\n", &n);
    char str[100];
    //fgets(str, 100, stdin);
    while(i<n)
    {
        i++;
        fgets(str, 100, stdin);
        //printf("%s", str);
        len = strlen(str) - 1;
        if(str[0]=='_'||isalpha(str[0]))
            for(int j=0;j<len;j++)
            {
                if(!(str[j]=='_'||isalpha(str[j])||isdigit(str[j])))
                {
                    cout<<"0"<< endl;
                    break;
                }
                else
                    if(j==len-1) cout<<"1"<<endl;
            }
        else  cout<<"0"<<endl;
    }
    return 0;
}


int main()
{
	char *p,str[81];
	int rd,n;
	scanf("%d",&n);
	getchar();
	for(rd=0;rd<n;rd++)
	{
		gets(str);
		p=str;
		for(;p<&str[strlen(str)];p++)
		{
			if(!(Check)&&p==str)
			{
				printf("0\n");
				break;
			}else{
				if(!(Check||(*p>='0'&&*p<='9')))
				{
					printf("0\n");
					break;
				}else if(p==&str[strlen(str)-1]){
					printf("1\n");
				}
			}
		}
	}
	return 0;
}


int f(char word[81])
{
	int i,signal=1;

		for(i=0;word[i];i++)
		{
			if((word[i]=='_')||(word[i]<='Z'&&word[i]>='A')||(word[i]>='a'&&word[i]<='z')||(word[i]>='0'&&word[i]<='9'&&i>0))
				continue;
			else
			{
				signal=0;
				break;
			}
		}
		if(signal==1)
			return 1;
		else
			return 0;

}

int main()
{
	char word[81];
	int n,i;
	cin >>n;
	for(i=0;i<n+1;i++)
	{
		cin.getline(word,81,'\n');
		if(i!=0)
			cout <<f(word)<<endl;
	}
	return 0;
}


void main()
{
    char a[100];
    int g=0;
    scanf("%d\n",&g);
    while(g--)
    {
        int flag = 0;
        gets(a);
        if(*a == '\0')
        {
             g++;
             continue;
        }
        char* p = a;
        for(p=a;p<a+strlen(a);p++)
        {
             if((!isalpha(*p))&&(!isdigit(*p))&&(*p!='_'))
             {
                   flag = 1;
                   printf("0\n");
                   break;
             }
        }
        if(flag == 1)
        {
             continue;
        }
        if(*a=='_'||isalpha(*a))
        {
             printf("1\n");
        }
        else
        {
             printf("0\n");
        }
    }
}


int work(char*input);
int compare(char a);
int main(int argc, char* argv[])
{
	int n=0,k=0;
	char n1[6],input[80];
           	gets(n1);
	n=atoi(n1);
	for(int i=0;i<n;i++)
	{
		gets(input);
		k=work(input);
		printf("%d\n",work(input));
	}
	return 0;
}
int work(char*input)
{
	char*p=input;
	char c='0';
	for(c='0';c<='9';c++)
	{
		if(*p==c)
			return 0;
	}
	int n=strlen(input);
	for(int i=0;i<n;i++)
	{
		if(compare(*(p+i))==0)
			return 0;
	}
	return 1;
}
int compare(char a)
{
	char c='0';
	for(c='0';c<='9';c++)
	{
		if(a==c)
			return 1;
	}
	for(c='A';c<='Z';c++)
	{
		if(a==c)
			return 1;
	}
	for(c='a';c<='z';c++)
	{
		if(a==c)
			return 1;
	}
   	if(a=='_')
	{return 1;}
	else return 0;
}


int islegal(char seq[],int size)
{
	int i,flag=1; char*ptr;
	ptr=seq;
	if(*ptr=='_'||isalpha(*ptr)!=0){
		for(i=1;i<size;i++){
			ptr=ptr+sizeof(char);
			if(*ptr!='_'&&isalpha(*ptr)==0
				&&isdigit(*ptr)==0){
				flag=0;break;
			}
		}
	}else{
		flag=0;}
	return flag;
}

int main()
{
	int n,i,len;
	char zfc[80000];
	gets(zfc);
	n=atoi(zfc);
	for(i=0;i<n;i++){
		gets(zfc);
		len=strlen(zfc);
		printf("%d\n",islegal(zfc,len));
	}
	return 0;
}


int main()
{
	int num(char);
	int le(char);
	int n,i,len;
	char str[100];
	scanf("%d",&n);
	getchar();
	while(n--)
	{
	  gets(str);
	  len=strlen(str);
	  if(!le(str[0]))
	  {
  		printf("0\n"); continue;
  	  }
  	  for(i=0;i<len;i++)
  	  {
  	  	if((!le(str[i]))&&(!num(str[i])))
  	  	  break;
  	  }
  	  if(i==len) printf("1\n");
  	  else printf("0\n");
	}
}
int le(char c)
{
	if('a'<=c&&c<='z') return 1;
	else if('A'<=c&&c<='Z') return 1;
	else if(c=='_') return 1;
	else return 0;
}
int num(char c)
{
	if('0'<=c&&c<='9') return 1;
	else return 0;
}


int pdshuzi(char zi)
{
    int zhi1;
	if(zi>='0'&&zi<='9')zhi1=1;
	else zhi1=0;
	return(zhi1);
}

int pdzimu(char zi)
{
	int zhi2;
	if((zi>='a'&&zi<='z')||(zi>='A'&&zi<='Z'))zhi2=1;
	  else zhi2=0;
	  return(zhi2);
}

int sort(char *head)
{
	char *t;
	int zhi,flag=1;
	t=head;
	if(pdzimu(*t)==1||*t=='_')zhi=1;
	else {zhi=0;return(zhi);}

	t++;
	for(;*t!='\0';t++)
	{if(pdzimu(*t)==1||pdshuzi(*t)==1||*t=='_')flag=1;
		  else flag=0;
		  if(flag==0){return(0);break;}}
	if(flag==1)return(1);

}

void main()
{
  char *name[100];
  char **p;
  int n,i;

  scanf("%d\n",&n);
  for(p=name,i=0;i<n;i++,p++)
	  *p=(char *)malloc(90*sizeof(char));

  for(p=name;p<name+n;p++)
	  gets(*p);

  for(p=name;p<name+n;p++)
	  printf("%d\n",sort(*p));
}


int panduan(char a){
	int result=0;
	if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||(a>='0'&&a<='9')||(a=='_'))
		 result=1;
	return result;
}
int first(char b){
	int result=0;
	if((b>='a'&&b<='z')||(b>='A'&&b<='Z')||(b=='_'))
		result=1;
	return result;
}
int main(int argc, char* argv[])
{
	int i,n,j,len,flag;
	int panduan(char a);
	int first(char b);
	char s[81];
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		gets(s);
		len=strlen(s);
		flag=1;
		if(first(s[0])==0)
			flag=0;
		else if(first(s[0])==1){
			for(j=1;j<len;j++){
				if(panduan(s[j])==0){
				flag=0;
				break;
				}
			}
		}
		if(flag==1){
			printf("1\n");
		}
		else{
			printf("0\n");
		}
	}
	return 0;
}


int identf(char *str);
int isKey(char *str);
int x_strcmp(char *si, char *di);

int main()
{
 char buffer[256];
 int n,i;
 scanf("%d",&n);
 gets(buffer);
 for (i=0;i<n;i++){
 gets(buffer);
 if(identf(buffer))
  puts("1");
 else
  puts("0");
 }
 return 0;
}
int identf(char *str)
{
 int flag=0;
 char *p=str;
 if((*str>='a' && *str<='z') || (*str>='A' && *str<='Z') || *str=='_')
 {
  flag=1;
  str++;
 }
 while(*str && flag)
 {
  if((*str>='a' && *str<='z') || (*str>='A' && *str<='Z') || *str=='_'
   || (*str>='0' && *str<='9'))
  {
   flag=1;
   str++;
  }
  else
   flag=0;
 }
 if(flag)
  flag=isKey(p);
 return flag;
}
int isKey(char *str)
{
 char *keyword[]={"auto", "break", "case", "char", "const", "continue", "default",
     "do", "double", "else", "enum", "extern", "float", "for", "goto",
     "if", "int", "long", "register", "return", "short", "signed",
     "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned",
     "void", "volatile", "while"};
 int i, flag=1;

 for(i=0; i<32; i++)
 {
  if(x_strcmp(str, keyword[i])==0)
  {
   flag=0;
   break;
  }
 }

 return flag;
}
int x_strcmp(char *si, char *di)
{
 while(*si && *di && *si==*di)
 {
  si++;
  di++;
 }
 return *si-*di;
}


int main()
{
    int i, j, n, l, flag;
    cin >> n;
    cin.get();
    for ( i = 1; i <= n; i++ )
    {
        flag = 1;
        char str[81];
        cin.getline ( str, 81 );
        if ( !(str[0] >= 'A' && str[0] <= 'z') && ( str[0] != '_' ) )
           flag = 0;
        l = strlen(str);
        if ( flag )
        {
             for ( j = 0; j < l;j++ )
             {
                 if ( str[j] >= 'A' && str[j] <= 'z' )
                    flag = 1;
                 else if ( str[j] >= '0' && str[j] <= '9' )
                         flag = 1;
                      else if ( str[j] == '_' )
                              flag = 1;
                           else
                           {
                               flag = 0;
                               break;
                           }
             }
        }
        cout << flag << endl;
    }
    return 0;
}


// asdddee.cpp : Defines the entry point for the console application.
//

int main()
{ char zifu[100];
   char a[10];
   int n,p,i,j,l;
      gets(a);
       n=atoi(a);
        for(i=0;i<n;i++){
             gets(zifu);
                 if(zifu[0]=='_'||(zifu[0]>='A'&&zifu[0]<='Z')||(zifu[0]>='a'&&zifu[0]<='z'))
				 {   l=1;
				         p=1;
                               for(j=1;zifu[j]!='\0';j++){
                                      if((zifu[j]>='A'&&zifu[j]<='Z')||(zifu[j]>='a'&&zifu[j]<='z')||(zifu[j]>='0'&&zifu[j]<='9')||zifu[j]=='_')
                                          p=1;
                                             else{
                                                p=0;
                                                    break;}
                                                        }

                               }
                 else
					 l=0;
				 if(l==0)
                      printf("0\n");
                            else if(p==1&&l==1)
                                          printf("1\n");
							                   else if(p==0)
												   printf("0\n");
                        }

  return 0;
}


int main()
{
	int k;
	char input[81];
	cin >>k;
	cin.get();
	while (k>0)
	{
		cin.getline(input,81);
		int i=1,leg=0;
	    if (input[0]=='_'||(input[0]>='a'&&input[0]<='z')||(input[0]>='A'&&input[0]<='Z'))
	      leg=1;
	    while (input[i]!=0)
	    {
		  if (leg==0) break;
		  else if ((input[i]>='a'&&input[i]<='z')||(input[i]>='A'&&input[i]<='Z')||(input[i]>='0'&&input[i]<='9')||input[i]=='_')
		        leg=1;
		  else leg=0;
		  i++;
	    }
		cout <<leg <<endl;
		k--;
	}

	return 0;
}


int main()
{
	int case_num;
	int i;
	int length;
	int result;
	char identifier[90];
	scanf("%d", &case_num);
	gets(identifier);
	while(case_num --) {
		gets(identifier);
		length = strlen(identifier);
		result = 1;
		if (length == 0 ||!(identifier[0] == '_' || isalpha((int)identifier[0])))
			result = 0;
		for (i = 1; i < length; i ++) {
			if (!(identifier[i] == '_' || isalpha((int)identifier[i]) || isdigit((int)identifier[i])))
				result = 0;
		}
		printf("%d\n", result);
	}
	return 0;
}


int main()
{
	int n;
	char line[100];
	int i;

	cin>>n;
	cin.get();

	while(n--)
	{
		cin.getline(line,100);
		if(line[0]!='_' && (line[0]>'z'||line[0]<'a')&&(line[0]>'Z'||line[0]<'A'))
		{
			cout<<"0"<<endl;
			continue;
		}
	//	cout<<"line="<<line<<endl;
		int len=strlen(line);
		for(i=1;i<len;i++)
		{
			if(line[i]!='_' && (line[i]>'z'||line[i]<'a')&&(line[i]>'Z'||line[i]<'A')&&(line[i]<'0'||line[i]>'9'))
			{
				cout<<"0"<<endl;
				break;
			}
		}
		if(i==len)
			cout<<"1"<<endl;
	}
	return 0;
}


int main()
{	int n,len,i,j,count;
	int a=1,b=0;
	char *p;
	char zfc[81];
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
		count=0;
		gets(zfc);
		len=strlen(zfc);
		p=zfc;
		if(*p=='_'||(*p>='A'&&*p<='z')){
			for(p=zfc+1;p<zfc+len;p++){
				if(*p!='_'&&(*p<'0'||(*p>'9'&&*p<'A')||*p>'z')){
					printf("%d\n",b);
					break;
				}
				count++;
			}
			if(count==len-1)
				printf("%d\n",a);
		}
		else
			printf("%d\n",b);
	}
	return 0;
}


int judge;
char zfc[81];

void judge1(char *p);
void judge1(char *p)
{
	if(!((*p>64&&*p<91)||(*p>96&&*p<123)||*p==95))
	{judge=0;}
	return;
}

void judge2(char *p);
void judge2(char *p)
{
	int len;
	len=strlen(zfc);
	int i;
	for(i=0;i<len;i++)
	{
		if(!((*(p+i)>64&&*(p+i)<91)||(*(p+i)>96&&*(p+i)<123)||*(p+i)==95||(*(p+i)>47&&*(p+i)<58)))
		{
			judge=0;
			break;
		}
	}
	return;
}

int main()
{
	int num;
	scanf("%d",&num);

	int i;
	char (*p)[30];
	for(i=0;i<num;i++)
	{
		judge=1;
		if(i==0)
		{getchar();}
		gets(zfc);
		p=&zfc;
		judge1(*p);
		judge2(*p);
		if(judge==0)
		{
			printf("0\n");
		}
		if(judge==1)
		{
			printf("1\n");
		}
	}
	return 0;
}


int main()
{
  int n,j;
  scanf("%d\n",&n);
  char string[100][81];
  for(int i=0;i<n;i++)
  gets(string[i]);//scanf("%s",string[i]);
  for(int i=0;i<n;i++)
  {
     int l=strlen(string[i]);
     j=0;
     if((string[i][0]>='A'&&string[i][0]<='Z')||(string[i][0]>='a'&&string[i][0]<='z')||string[i][0]=='_')
          {
          for(j=0;j<l;j++)
          if(string[i][j]>='A'&&string[i][j]<='Z'||string[i][j]>='a'&&string[i][j]<='z'||string[i][j]=='_'||string[i][j]>='0'&&string[i][j]<='9')
          continue;
           else
          break;
          }
          if(j>=l)
          printf("1\n");
          else
          printf("0\n");

  }
}


char na[100];

int main ( )
{
	int num;
	cin >> num;
	cin.getline ( na, 100 );
	while ( num -- )
	{
		memset ( na, ' ', sizeof ( na ) );
		cin.getline ( na, 100 );
		int index = 0, len = 0;
		len = strlen ( na );
		if ( !( na[index] == '_' || ( na[index] <= 'z' && na[index] >= 'a' ) || ( na[index] <= 'Z' && na[index] >= 'A' ) ) )
		{
			cout << 0 << endl;
			continue;
		}
		index ++;
		for (  ; index < len; index ++ )
		{
			if ( na[index] == '_' || (na[index] >= '0' && na[index] <= '9' ) || ( na[index] <= 'z' && na[index] >= 'a' ) || ( na[index] <= 'Z' && na[index] >= 'A' ) )
				continue;
			else
			{
				cout << 0 << endl;
				break;
			}
		}
		if ( index == len )
			cout << 1 << endl;
	}
	return 0;
}


int main()
{
	char * character,sz[81];
	int i,j,n,e;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		e=0;
		character=sz;
		gets(character);
		if(*character=='_'||(*character>=65&&*character<=90)||(*character>=97&&*character<=122))
		{
			for(; *character!='\0';++character)
			{
				if(*character=='_'||(*character>=65&&*character<=90)||
					(*character>=97&&*character<=122)||(*character>=48&&*character<=57))
					continue;
				else
				{
					printf("%d\n",0);
					e=1;
					break;
				}
			}
			if(e==0)
				printf("%d\n",1);
		}
		else
			printf("%d\n",0);
	}
	return 0;
}


int main()
{
	int n,i,j,len,sign;
	scanf("%d",&n);
	getchar();
	char a[81];
    for(i=1;i<=n;i++)
	{
		gets(a);
		len=strlen(a);
		sign=1;
		if(a[0]!=95&&isalpha(a[0])==0)sign=0;
        for(j=1;j<len;j++)
		{	if(isalnum(a[j])==0&&a[j]!=95)sign=0;}
		printf("%d\n",sign);
	}
	return 0;
}


int number(char a)
{
    int c;
    c=a-'0';
    if(c>=0&&c<=9)
    return 1;
    else
    return 0;
}
int line(char a)
{
    int c;
    c=a-'_';
    if(c==0)
    return 1;
    else
    return 0;
}
int small(char a)
{
    int c;
    c=a-'a';
    if(c>=0&&c<=25)
    return 1;
    else
    return 0;
}
int big(char a)
{
    int c;
    c=a-'A';
    if(c>=0&&c<=25)
    return 1;
    else
    return 0;
}
int main()
{
    int n,i,j,c;
    char a[81];
    int b[100]={0};
    scanf("%d",&n);
    scanf("%c",&a[0]);
    for(i=1;i<=n;i++)
    {
        b[i-1]=1;
        for(j=1;j<=81;j++)
        {
            scanf("%c",&a[j-1]);
            c=a[j-1]-'\n';
            if(c==0)
            break;
            c=line(a[j-1])+number(a[j-1])+big(a[j-1])+small(a[j-1]);
            if(c==0)
            {
                b[i-1]=0;
            }
        }
        if(number(a[0])==1)
        b[i-1]=0;
    }
    for(i=1;i<=n;i++)
    printf("%d\n",b[i-1]);
    return 0;
}


int main()
{	int n,len,i,j,count;
	int a=1,b=0;
	char *p;
	char zfc[81],tem[2];
	gets(tem);
	n=atoi(tem);
	for(i=0;i<n;i++){
		count=0;
		gets(zfc);
		len=strlen(zfc);
		p=zfc;
		if(*p=='_'||(*p>='A'&&*p<='z')){
			for(p=zfc+1;p<zfc+len;p++){
				if(*p!='_'&&(*p<'0'||(*p>'9'&&*p<'A')||*p>'z')){
					printf("%d\n",b);
					break;
				}
				count++;
			}
			if(count==len-1)
				printf("%d\n",a);
		}
		else
			printf("%d\n",b);
	}
	return 0;
}


int function1(char zimu)
{
    int panduan;
    panduan=zimu;
    if (((panduan>=65)&&(panduan<=90))||((panduan>=97)&&(panduan<=122))||(panduan==95)) return 1;//???????????
    else return 0;
}//?????????????
char function2(char zimu)
{
    int panduan;
    panduan=zimu;
    if (((panduan>=65)&&(panduan<=90))||((panduan>=97)&&(panduan<=122))||(panduan==95)||((panduan>=48)&&(panduan<=57))) return 1;//??????????????
    else return 0;//????????????????
}

int main()
{
    char str[81];
    int n,i,j,count,changdu,panduan;
    cin>>n;
    for(i=0;i<n;i++)
    {
                    cin.get();
                    count=0;
                    cin.get(str,81);
                    changdu=strlen(str);
                    if(changdu==0)cout<<" 0"<<endl;
                    else
                    {
                       for(j=0;j<changdu;j++)
                       {
                        if(j==0)
                        {
                                if(function1(str[j]))count++;
                        }
                        else
                        {
                                if(function2(str[j]))count++;
                        }
                       }
                       if(count==changdu && count!=0)cout<<"1"<<endl;//?????????????
                       else cout<<"0"<<endl;
                    }
    }
cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();
return 0;
}


/*??,???????????????*/

main()
{
      char *k;int n;int num;int i; int pd; int j;
      scanf("%d",&n);int *q;
      char *p[n];
      k=(char *)malloc(81*sizeof(char));gets(k);
      p[0]=k;
      for(i=1;i<n+1;i++)
      {
                    k=(char *)malloc(81*sizeof(char));
                    gets(k);
                    p[i]=(char *)malloc(81*sizeof(char));
                    p[i]=k;
      }

      for(i=1;i<n+1;i++)
      {
                    num=strlen(p[i]);
                    if(*p[i]=='_'||isalpha(*p[i]))
                    pd=1;
                    else
                    pd=0;

                    p[i]++;

                    for(j=1;j<num;j++)
                    {

                           if(isalnum(*p[i]))
                           {
                           p[i]++;
                           }
                           else if(*p[i]=='_')
                           p[i]++;
                           else
                           {
                               pd=0;break;
                           }

                     }
      printf("%d\n",pd);
      }

      }


int judgeletter(char);
int judgeline(char);
int judgenum(char);
void emp(char *);

int main()
{
	int n,i,j,length;
	char s[81];
	scanf("%d",&n);
	gets(s);
	for(i=0 ; i<n ; i++){
		emp(s);
		gets(s);
		length = strlen(s);
		if( length == 1){
			printf("%d\n",( judgeletter(*s) || judgeline(*s) ) );
			continue;
		}else{
			if( ( judgeletter(*s) || judgeline(*s) ) == 0 ){
				printf("0\n");
				continue;
			}else{
				for(j=1 ; *(s+j) ; j++){
					if( ( judgeletter(*(s+j)) || judgeline(*(s+j)) || judgenum(*(s+j)) ) == 0 ){
						printf("0\n");
						break;
					}
				}
				if( j==length )
					printf("1\n");
			}
		}
	}

	return 0;
}

int judgeletter( char c)
{
	if( (c>='a' && c<='z') || (c>='A' && c<='Z') )
		return 1;
	else
		return 0;
}

int judgeline( char c )
{
	if( c == '_' )
		return 1;
	else
		return 0;
}

int judgenum( char c )
{
	if( c>='0' && c<='9' )
		return 1;
	else
		return 0;
}

void emp( char *s )
{
	int i;
	for(i=0 ; *(s+i) ; i++){
		*(s+i)='\0';
	}
}


int isLegal(char *str)
{
    if (!isalpha(*str) && *str != '_') return 0;
    for (str++;*str;str++)
        if (!isalpha(*str) && !isdigit(*str) && *str != '_') return 0;
    return 1;
}
int main()
{
    char str[100];
    int n;
    scanf("%d", &n);
    gets(str);
    while (n--)
    {
          gets(str);
          printf("%d\n", isLegal(str));
    }
    return 0;
}


int isA(char a)
{
	if( (a>='0' && a<='9')|| (a>='a' && a<='z') || (a>='A' && a<='Z') ||a=='_')return 1;
	return 0;
}
int isStart(char a)
{
	if(  (a>='a' && a<='z') || (a>='A' && a<='Z') ||a=='_')return 1;
	return 0;
}
int main()
{
		int i=0, n = 0;
		scanf("%d\n",&n);
		char array[300][81] ;
		for(i = 0 ; i<n ; i++)
		{
			gets(array[i]);
		}
		for(i = 0 ; i<n ; i++)
		{
			int len = strlen(array[i]);
			int j = 0;
			int flag = 1;
			if(isStart(array[i][0])==1){
				for(;j<len;j++)
				{
					if(isA(array[i][j])==0)flag=0;
				}
			}
			else flag= 0 ;
			if(flag==1)printf("1\n");
			else printf("0\n");
		}
		return 0;
}


int f(char c)
{
 if(c>='a'&&c<='z') return 1;
 if(c>='A'&&c<='Z') return 1;
 if(c=='_') return 1;
 else return 0;
}
main()
{
 int a,n;
 int i;
 scanf("%d",&n);
 char str1[2];
 gets(str1);
 while(n--)
 {
  char str[100]={""};
  gets(str);
  int len=strlen(str);
  if(f(str[0])==1)
  {
   for(i=1;str[i]!='\0';i++)
   if((str[i]>='0'&&str[i]<='9')||f(str[i])==1) continue;
   else break;
   if(i==len) printf("%d\n",1);
   else printf("%d\n",0);
  }
  else
  printf("%d\n",0);
 }
}


int zimuxiahuaxian(char x)
{
	int a;
	if((x>=65&&x<=90)||(x>=97&&x<=122)||x=='_') a=1;
	else a=0;
	return a;
}

int shuzi(char x)
{
	int a;
	if((x>=48)&&(x<=57)) a=1;
	else a=0;
	return a;
}
int main()
{
	int n,i,m,j,k=0;
	char a[81];
	scanf("%d",&n);
	gets(a);
	for(i=0;i<n;i++)
	{
		gets(a);
        m=strlen(a);
		if(zimuxiahuaxian(a[0])==0) k=0;
		else
		{
			k=1;
			for(j=1;j<m;j++)
			{
                if(zimuxiahuaxian(a[j])!=1&&shuzi(a[j])!=1)
				{
					k=0;
					break;
				}
				else k=1;
			}
		}
		if(k==0) printf("0\n");
		else printf("1\n");
	}
	return 0;
}


int legal(char zfc[81]);

int main(int argc, char* argv[])
{
	int n,i,judge;
	char str[81];
         gets(str);
         n = atoi(str);
	for(i=0;i<n;i++)
	{
		gets(str);
		judge=legal(str);
		printf("%d\n",judge);
	}

	return 0;
}

int legal(char zfc[81])
{
	int lenth,i,m=1;
	lenth=strlen(zfc);

	if(zfc[0]=='_'||(zfc[0]>='A'&&zfc[0]<='Z')||(zfc[0]>='a'&&zfc[0]<='z'))
	{
		for(i=1;i<lenth;i++)
		{
			if((zfc[i]>='A'&&zfc[i]<='Z')||(zfc[i]>='a'&&zfc[i]<='z')||(zfc[i]>='0'&&zfc[i]<='9')||zfc[i]=='_')
				m=1;
			else
			{
				m=0;break;
			}
		}
		if(m)
			return 1;
		else
			return 0;
	}
	else
		return 0;
}


void main()
{
	int n;
	scanf("%d\n",&n);
	int i;
	for(i=1;i<=n;i++)
	{
		char *pnew;
		pnew=(char *)malloc(100*sizeof(char));
		gets(pnew);
		int L=strlen(pnew);
		int judge=0;
		int j;

        if(*pnew=='_')
		{
			judge=1;
		for(j=1;j<L;j++)
		{
		if(*(pnew+j)=='_')
			judge=1;
		else if(*(pnew+j)<='z'&&*(pnew+j)>='a')
			judge=1;
		else if(*(pnew+j)<='Z'&&*(pnew+j)>='A')
			judge=1;
		else if(*(pnew+j)<='9'&&*(pnew+j)>='0')
			judge=1;
		else
		{
			judge=0;
			break;
		}
		}
		}

		else if(*pnew<='z'&&*pnew>='a')
		{
			judge=1;
		for(j=1;j<L;j++)
		{
		if(*(pnew+j)=='_')
			judge=1;
		else if(*(pnew+j)<='z'&&*(pnew+j)>='a')
			judge=1;
		else if(*(pnew+j)<='Z'&&*(pnew+j)>='A')
			judge=1;
		else if(*(pnew+j)<='9'&&*(pnew+j)>='0')
			judge=1;
		else
		{
			judge=0;
			break;
		}
		}
		}

		else if(*pnew<='Z'&&*pnew>='A')
		{
			judge=1;
		for(j=1;j<L;j++)
		{
		if(*(pnew+j)=='_')
			judge=1;
		else if(*(pnew+j)<='z'&&*(pnew+j)>='a')
			judge=1;
		else if(*(pnew+j)<='Z'&&*(pnew+j)>='A')
			judge=1;
		else if(*(pnew+j)<='9'&&*(pnew+j)>='0')
			judge=1;
		else
		{
			judge=0;
			break;
		}
		}
		}

		else
			judge=0;
		printf("%d\n",judge);
	}
}


int main(void)
{
	char string[200][100];
	int n;
	cin>>n;
	getchar();
	int i;
	for(i=0;i<n;i++)
	{
		cin.getline(string[i],100);
	}
	for(i=0;i<n;i++)
	{
		int k=1;
		for(int j=0;j<strlen(string[i]);j++)
		{
			if(j==0)
			{
				if((string[i][j]=='_')||(string[i][j]>='A'&&string[i][j]<='Z')||(string[i][j]>='a'&&string[i][j]<='z'));
				else
					k=0;
			}
			else
			{
				if(string[i][j]=='_'||(string[i][j]>='A'&&string[i][j]<='Z')||(string[i][j]>='a'&&string[i][j]<='z')||(string[i][j]>='0'&&string[i][j]<='9'));
				else
					k=0;
			}
		}
		if(k==0)
			cout<<0<<endl;
		else
			cout<<1<<endl;
	}
	int a;
	cin>>a;
	return 0;
}


void main(){
	int n,len,check;
	int i;
	char name[81],num[10];
	gets(num);
	n=atoi(num);
	while(n--){
		check=1;
		gets(name);
		len=strlen(name);
		for(i=0;i<len;i++){
			if(i==0){
				if((name[i]=='_')||(name[i]>='A'&&name[i]<='Z')||(name[i]>='a'&&name[i]<='z')){
					continue;
				}else{
					check=0;
					break;
				}
			}else{
				if((name[i]>='A'&&name[i]<='Z')||(name[i]>='a'&&name[i]<='z')||(name[i]>='0'&&name[i]<='9')||(name[i]=='_')){
					continue;
				}else{
					check=0;
					break;
				}
			}
		}
		printf("%d\n",check);
	}
}


int check(char a)
{   if(a-'a'>=0&&a-'z'<=0)
    return 1;
 else   if(a-'A'>=0&&a-'Z'<=0 )
    return 1;
 else   if(a-'_'==0)
    return 1;
   else
    return 0;
}
int check1(char a)
{   if(a-'a'>=0&&a-'z'<=0)
    return 1;
 else   if(a-'A'>=0&&a-'Z'<=0 )
    return 1;
 else   if(a-'_'==0)
    return 1;
 else if(a-'0'>=0&&a-'9'<=0)
   return 1;
   else
    return 0;
}
int check2(char a[],int n)
{   int i,t;
    for(i=1,t=0;i<n;i++)
    if(check1(a[i])!=1)
      return 0;
    return 1;

}
main()
{   int n;
    scanf("%d",&n);
    char a[200][100];
    getchar();
    int i,t;
    for(i=1;i<=n;i++)
  {  gets(a[i]);
    t= strlen(a[i]);
    if(check(a[i][0])&&check2(a[i],t))
     printf("1\n" );
     else
     printf("0\n");

}

}


//#include <string>

int main()
{
	int grids[100][100]; //y x; grids: 0 noperson,1 healthyperson,2 illperson
	int n, i, j, k, day, illCount = -1, illCount0, lastIllCount = 0, illHistory[10000][2];
	char stat;
	cin >> n;
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
		{
			cin >> stat;
			switch (stat)
			{
			case '.':
				grids[i][j] = 1;
				break;
			case '#':
				grids[i][j] = 0;
				break;
			case '@':
				grids[i][j] = 2;
				illCount++;
				illHistory[illCount][0] = i;
				illHistory[illCount][1] = j;
				break;
			}
		};
	cin >> day;
	if (illCount != -1)
	{
		for (k = 1; k < day; k++)
		{
			illCount0 = illCount;
			for (i = lastIllCount; i <= illCount0; i++)
			{
				if (illHistory[i][0] != 0 && grids[illHistory[i][0] - 1][illHistory[i][1]] == 1)
				{
					grids[illHistory[i][0] - 1][illHistory[i][1]] = 2;
					illCount++;
					illHistory[illCount][0] = illHistory[i][0] - 1;
					illHistory[illCount][1] = illHistory[i][1];
				}
				if (illHistory[i][1] != 0 && grids[illHistory[i][0]][illHistory[i][1] - 1] == 1)
				{
					grids[illHistory[i][0]][illHistory[i][1] - 1] = 2;
					illCount++;
					illHistory[illCount][0] = illHistory[i][0];
					illHistory[illCount][1] = illHistory[i][1] - 1;
				}
				if (illHistory[i][0] != n - 1 && grids[illHistory[i][0] + 1][illHistory[i][1]] == 1)
				{
					grids[illHistory[i][0] + 1][illHistory[i][1]] = 2;
					illCount++;
					illHistory[illCount][0] = illHistory[i][0] + 1;
					illHistory[illCount][1] = illHistory[i][1];
				}
				if (illHistory[i][1] != n - 1 && grids[illHistory[i][0]][illHistory[i][1] + 1] == 1)
				{
					grids[illHistory[i][0]][illHistory[i][1] + 1] = 2;
					illCount++;
					illHistory[illCount][0] = illHistory[i][0];
					illHistory[illCount][1] = illHistory[i][1] + 1;
				}
			}
			lastIllCount = illCount0;
		}
	}
	cout << illCount + 1;
	return 0;
}


int DORM[MAXN][MAXN],N,SIGN[MAXN][MAXN];
void aff(int x,int y);

int main(){
    memset(DORM,0,sizeof(DORM));
    memset(SIGN,0,sizeof(SIGN));
    int M,sum=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin.get();
        for(int j=0;j<N;j++){
            char m;
            cin.get(m);
            switch(m){
                case '.':
                    DORM[i][j]=-1;
                    break;
                case '#':
                    DORM[i][j]=0;
                    break;
                case '@':
                    DORM[i][j]=1;
                    break;
            }
        }
    }
    cin>>M;
    for(int m=1;m<M;m++){
        memset(SIGN,0,sizeof(SIGN));
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(DORM[i][j]==1&&SIGN[i][j]==0){
                    aff(i,j+1);
                    aff(i,j-1);
                    aff(i+1,j);
                    aff(i-1,j);
                }
            }
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(DORM[i][j]==1) sum++;
        }
    }
    cout<<sum;
    return 0;
}
void aff(int x,int y){
    if(x>=0&&x<N&&y>=0&&y<N){
        if(DORM[x][y]==-1&&SIGN[x][y]==0){
            DORM[x][y]=1;
            SIGN[x][y]=1;
        }
    }
}


int main()

{

	char sz[110][110];

	int n,row,col;

	scanf("%d",&n);

	char s0[110];

	for(row=0;row<n;row++){

		scanf("%s",s0);

		for(col=0;col<n;col++){

			//scanf("%",&sz[row][col]);

			sz[row][col]=s0[col];

			//if(sz[row][col]=='\n') col=col-1;

		}

	}

	for(row=0;row<n;row++){

		for(col=0;col<n;col++){

			if(sz[row][col]=='.') sz[row][col]=1;

			if(sz[row][col]=='@') sz[row][col]=2;

			if(sz[row][col]=='#') sz[row][col]=3;

		}

	}

	int m,i;

	char szz[110][110];

	scanf("%d",&m);

	for(i=0;i<m-1;i++){

		for(row=0;row<n;row++){

			for(col=0;col<n;col++){

				if(sz[row][col]==2){

					if(sz[row-1][col]==1) szz[row-1][col]=2;

					if(sz[row+1][col]==1) szz[row+1][col]=2;

					if(sz[row][col+1]==1) szz[row][col+1]=2;

					if(sz[row][col-1]==1) szz[row][col-1]=2;

				}

			}

		}

		for(row=0;row<n;row++){

			for(col=0;col<n;col++){

				if(szz[row][col]==2) sz[row][col]=2;

			}

		}

	}

	int s=0;

	for(row=0;row<n;row++){

		for(col=0;col<n;col++){

			if(sz[row][col]==2) s=s++;

		}

	}

	printf("%d",s);

	return 0;

}


int main() {
	int n;
	cin >> n;
	char zhen[110][110] = {'\0'};  // to store the state of each room
	for(int i = 1; i <= n; i++)  // input part
		for(int j = 1; j <= n; j++)
			cin >> zhen[i][j];
    int m;
	cin >> m;
	char zhen1[110][110] = {'\0'};
	if(m != 1) {
		for(int i = 1; i < m; i++) {
			  for(int i = 1; i <= n; i++)    // build a new zhen1 to store the change of state of each day
				  for(int j = 1; j <= n; j++)
					  zhen1[i][j] = zhen[i][j];   // copy the whole zhen to the zhen1
              for(int i = 1; i <= n; i++)
				  for(int j = 1; j <= n; j++) {  // make the change in the zhen1
					  if(zhen[i][j] == '@' && zhen[i - 1][j] != '#') zhen1[i - 1][j] = '@';
					  if(zhen[i][j] == '@' && zhen[i + 1][j] != '#') zhen1[i + 1][j] = '@';
					  if(zhen[i][j] == '@' && zhen[i][j - 1] != '#') zhen1[i][j - 1] = '@';
					  if(zhen[i][j] == '@' && zhen[i][j + 1] != '#') zhen1[i][j + 1] = '@';
				  }
			  for(int i = 1; i <= n; i++)       // copy the whole zhen1 to the zhen
				  for(int j = 1; j <= n; j++)
					  zhen[i][j] = zhen1[i][j];
		}
	}
	int sum = 0; // count the number of  patients
    for(int i = 1; i<= n; i++)
		for(int j = 1; j <= n; j++) {
			if(zhen[i][j] == '@') sum++;
		}
	cout << sum << endl;
	return 0;
}


//#include <string>
int grids[100][100][100] = {0}; //day y x; grids: 0 noperson,1 healthyperson,2 illperson

int main()
{
	int n, i, j, k, day, illCount = 0;
	char stat;
	cin >> n;
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
		{
			cin >> stat;
			switch (stat)
			{
			case '.':
				grids[0][i][j] = 1;
				break;
			case '#':
				grids[0][i][j] = 0;
				break;
			case '@':
				grids[0][i][j] = 2;
				illCount++;
				break;
			}
		};
	cin >> day;
	for (i = 1; i < day; i++)
		for (j = 0; j < n; j++)
			for(k = 0; k < n; k++)
			{
				if (grids[i - 1][j][k] == 2)
				{
					grids[i][j][k] = 2;
					if (j != 0 && grids[i - 1][j - 1][k] == 1 && grids[i][j - 1][k] != 2)
					{
						illCount++;
						grids[i][j - 1][k] = 2;
					}
					if (j != n - 1 && grids[i - 1][j + 1][k] == 1 && grids[i][j + 1][k] != 2)
					{
						illCount++;
						grids[i][j + 1][k] = 2;
					}
					if (k != 0 && grids[i - 1][j][k - 1] == 1 && grids[i][j][k - 1] != 2)
					{
						illCount++;
						grids[i][j][k - 1] = 2;
					}
					if (k != n - 1 && grids[i - 1][j][k + 1] == 1 && grids[i][j][k + 1] != 2)
					{
						illCount++;
						grids[i][j][k + 1] = 2;
					}
				}
				else
				{
					if (grids[i][j][k] != 2)
						grids[i][j][k] = grids[i - 1][j][k];
				}
			}
	cout << illCount;
	return 0;
}


int main ()
{
    int n,m, data[100][100], counter = 0;
    char temp;
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++){
            cin >> temp;
            switch(temp){
                case '.' :data[i][j] = 0;break;
                case '#' :data[i][j] = -1; break;
                case '@' :data[i][j] = 1; break;
            }
        }
    cin >> m;
    for (int k = 2; k <= m; k++)
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (data[i][j]==k-1){
                    if (i+1<n && !data[i+1][j]) data[i+1][j] = k;
                    if (i-1>=0 && !data[i-1][j]) data[i-1][j] = k;
                    if (j+1<n && !data[i][j+1]) data[i][j+1] = k;
                    if (j-1>=0 && !data[i][j-1]) data[i][j-1] = k;
            }
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            if (data[i][j] > 0) counter++;
    cout << counter;
    return 0;
}


char pain[101][102][102];
void trans(int,int,int);
int main()
{
	int n,i,j,t,day;
	cin>>n;
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			cin>>pain[1][i][j];
	cin>>day;
	for(t=2;t<=day;t++)
	{
		for(i=1;i<=n;i++)
			for(j=1;j<=n;j++)
				pain[t][i][j]=pain[t-1][i][j];
		for(i=1;i<=n;i++)
			for(j=1;j<=n;j++)
				if(pain[t-1][i][j]=='@')
				{
					trans(t,i-1,j);
					trans(t,i+1,j);
					trans(t,i,j-1);
					trans(t,i,j+1);
				}
	}
	int count=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			if(pain[day][i][j]=='@')
				count++;
	cout<<count<<endl;
	return 0;
}

void trans(int t,int i,int j)
{
	if(pain[t-1][i][j]=='.')
		pain[t][i][j]='@';
}


int main()
{
	int n;
	cin>> n;
	char fangzi[max][max];
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin>>fangzi[i][j];
	int day;
	cin>>day;
	for(int i=0;i<day-1;i++)
	{
		for(int j=0;j<n;j++)
			for(int k=0;k<n;k++)
				if(fangzi[j][k]=='@')
				{
					if(j>0&&fangzi[j-1][k]=='.')fangzi[j-1][k]='%';
					if(j<n-1&&fangzi[j+1][k]=='.')fangzi[j+1][k]='%';
					if(k>0&&fangzi[j][k-1]=='.')fangzi[j][k-1]='%';
					if(k<n-1&&fangzi[j][k+1]=='.')fangzi[j][k+1]='%';
				}
			for(int j=0;j<n;j++)
			for(int k=0;k<n;k++)
				if(fangzi[j][k]=='%')fangzi[j][k]='@';

	}
	int answer=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(fangzi[i][j]=='@')answer++;
	cout<<answer;

}


int main(){
    int d,day,row,list,n,sum;
    char A[102][102];
    row=0;
    while(row<102){
        list=0;
        while(list<102){
            A[row][list]='#';
            list++;
        }
        row++;
    }
    scanf("%d\n\n",&n);
    row=1;
    while(row<n+1){
        list=1;
        while(list<n+1){
            if(list==n){
            scanf("%c\n\n",&A[row][list]);}
            else{
                scanf("%c",&A[row][list]);
            }
            list++;
        }
        row++;
    }
    scanf("%d",&day);
    d=1;
    while(d<day){
        row=1;
        while(row<n+1){
            list=1;
            while(list<n+1){
                if(A[row][list]=='@'){
                    if(A[row+1][list]=='.'){
                        A[row+1][list]='x';
                    }
                    if(A[row-1][list]=='.'){
                        A[row-1][list]='x';
                    }
                    if(A[row][list+1]=='.'){
                        A[row][list+1]='x';
                    }
                    if(A[row][list-1]=='.'){
                        A[row][list-1]='x';
                    }
                }
                list++;
            }
            row++;
        }
        row=1;
        while(row<n+1){
            list=1;
            while(list<n+1){
                if(A[row][list]=='x'){
                    A[row][list]='@';
                }
                list++;
            }
            row++;
        }
        d++;
    }
    row=1;
    sum=0;
    while(row<n+1){
        list=1;
        while(list<n+1){
            if(A[row][list]=='@'){
                sum=sum+1;
            }
            list++;
        }
        row++;
    }
    printf("%d",sum);
    return 0;
}


int main() {
	int n;
	cin >> n;
	char zhen[110][110] = {'\0'};  // to store the state of each room
	for(int i = 1; i <= n; i++)  // input part
		for(int j = 1; j <= n; j++)
			cin >> zhen[i][j];
    int m;
	cin >> m;
	char zhen1[110][110] = {'\0'};
	if(m != 1) {
		for(int i = 1; i < m; i++) {
			  for(int i = 1; i <= n; i++)    // build a new zhen1 to store the change of state of each day
				  for(int j = 1; j <= n; j++)
					  zhen1[i][j] = zhen[i][j];
              for(int i = 1; i <= n; i++)
				  for(int j = 1; j <= n; j++) {
					  if(zhen[i][j] == '@' && zhen[i - 1][j] != '#') zhen1[i - 1][j] = '@';
					  if(zhen[i][j] == '@' && zhen[i + 1][j] != '#') zhen1[i + 1][j] = '@';
					  if(zhen[i][j] == '@' && zhen[i][j - 1] != '#') zhen1[i][j - 1] = '@';
					  if(zhen[i][j] == '@' && zhen[i][j + 1] != '#') zhen1[i][j + 1] = '@';
				  }
			  for(int i = 1; i <= n; i++)
				  for(int j = 1; j <= n; j++)
					  zhen[i][j] = zhen1[i][j];
		}
	}
	int sum = 0; // count the number of  patients
    for(int i = 1; i<= n; i++)
		for(int j = 1; j <= n; j++) {
			if(zhen[i][j] == '@') sum++;
		}
	cout << sum << endl;
	getchar();
	getchar();
	return 0;
}


int number;
char roms[MAXN][MAXN];

void days_go();
int count();

int main()
{
    int renshu;
    int iter;
    int days;
    scanf("%d",&number);
    for(iter = 0 ; iter != number ;++iter)
    {
        scanf("%s",roms[iter]);
    }
    scanf("%d",&days);
    for(iter = 1 ; iter != days ; ++iter)
    {
        days_go();
    }
    renshu = count();
    printf("%d",renshu);
    return 0;
}

void days_go()
{
    int iterout , iterin;
    int i,j;
    for(iterout = 0 ; iterout != number ; ++iterout)
    {
        for(iterin = 0 ; iterin != number ; ++iterin)
        {
     if('@' == roms[iterout][iterin])
        {
         i= iterout-1;
      if(-1 !=j)
         {
       j= iterin;
          if('.' == roms[i][j])
         {
       roms[i][j] = '!';
                    }
                }
     i = iterout;
      j= iterin-1;
    if(-1 != j)
        {
              if('.' == roms[i][j])
             {
            roms[i][j] = '!';
                    }
           }
     j= iterin+1;
        if(number != j)
     {
   if('.' == roms[i][j])
        {
     roms[i][j] = '!';
          }
    }
    i= iterout+1;
  if(number != i)
            {
                    j = iterin;
            if('.' == roms[i][j])
             {
         roms[i][j] = '!';
     }
}
    }
    }
    }
    for(iterout = 0 ; iterout != number ; ++iterout)
    {
   for(iterin = 0 ; iterin != number ; ++iterin)
    {
 if('!' == roms[iterout][iterin])
      {
                roms[iterout][iterin] = '@';
       }
  }
  }
}

int count()
{
 int total = 0;
 int iterout , iterin;
 for(iterout = 0 ; iterout != number ; ++iterout)
    {
     for(iterin = 0 ; iterin != number ; ++iterin)
 {
 if('@' == roms[iterout][iterin])
 {
      ++total;
     }
  }
}
    return total;
}


// test.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"

const int dx[4]={0,-1,1,0};
const int dy[4]={-1,0,0,1};
int main()
//int _tmain(int argc, _TCHAR* argv[])
{
	int n;
	char a[100][100];
	cin>>n;
	for (int i=0;i<n;i++)
		for(int j=0;j<n;j++)
	{
		cin>>a[i][j];
	}
	int m;
	cin>>m;
	for (int t=0;t<m-1;t++)
	{
		for (int i=0;i<n;i++)
			for(int j=0;j<n;j++)
		{
			if (a[i][j]=='@')
				for (int k=0;k<4;k++)
				{
					if ((i+dx[k]<n)&&(i+dx[k]>=0)&&(j+dy[k]<n)&&(j+dy[k]>=0)&&(a[i+dx[k]][j+dy[k]]=='.'))
						a[i+dx[k]][j+dy[k]]='N';
				}
		}
		for (int i=0;i<n;i++)
			for(int j=0;j<n;j++)
			{if (a[i][j]=='N') a[i][j]='@';}
	}
	int sum=0;
	for (int i=0;i<n;i++)
		for(int j=0;j<n;j++)
	{
		if (a[i][j]=='@') sum++;
		}
		cout<<sum<<endl;
}


int main(){
    int n;
    scanf("%d\n",&n);
    char sz[101][101];
    int row, col;
    for (row=0;row<=n+1;row++){
        for (col=0;col<=n+1;col++){
            sz[row][col]='#';
        }
    }
    for (row=1;row<=n;row++){
        for (col=1;col<n;col++){
            scanf("%c",&sz[row][col]);
        }
        scanf("%c\n", &sz[row][n]);
    }
    int m;
    scanf("%d",&m);
    int day;
    int people;
    people=0;
    for(day=1;day<m;day++){
        for (row=1;row<=n;row++){
            for (col=1;col<=n;col++){
                if(sz[row][col]=='@'){
                if(sz[row][col+1]=='.'){
                    sz[row][col+1]='a';
                }
                if(sz[row][col-1]=='.'){
                    sz[row][col-1]='a';
                }
                if(sz[row-1][col]=='.'){
                    sz[row-1][col]='a';
                }
                if (sz[row+1][col]=='.'){
                    sz[row+1][col]='a';
                }
              }
            }
        }
        for(row=1;row<=n;row++){
            for(col=1;col<=n;col++){
                if(sz[row][col]=='a'){
                    sz[row][col]='@';
                }
        }
        }
    }
    for(row=1;row<=n;row++){
        for (col=1;col<=n;col++){
            if(sz[row][col]=='@'){
                people=people+1;
            }
        }
    }
    printf("%d",people);
    return 0;
}


char room[100][100];
int sum=0;
int row[10000],col[10000];
void spread(int counts,char a[100][100])
{
	for(int i=0;i<sum;i++)
	{
		if(a[row[i]+1][col[i]]=='.')
		{
			a[row[i]+1][col[i]]='@';
			row[counts]=row[i]+1;col[counts]=col[i];counts++;
		}
		if(a[row[i]-1][col[i]]=='.')
		{
			a[row[i]-1][col[i]]='@';
			row[counts]=row[i]-1;col[counts]=col[i];counts++;
		}
		if(a[row[i]][col[i]+1]=='.')
		{
			a[row[i]][col[i]+1]='@';
			col[counts]=col[i]+1;row[counts]=row[i];counts++;
		}
		if(a[row[i]][col[i]-1]=='.')
		{
			a[row[i]][col[i]-1]='@';
			col[counts]=col[i]-1;row[counts]=row[i];counts++;
		}
	}
	sum=counts;
}
int main()
{
	memset(row,-1,sizeof(row));
	memset(col,-1,sizeof(col));
	int n,i,j,m;
	cin>>n;
	memset(room,'\0',sizeof(room));
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
		{
			cin>>room[i][j];
			if(room[i][j]=='@')
			{
				row[sum]=i;col[sum]=j;
				sum++;
			}
		}
	cin>>m;
	for(i=0;i<m-1;i++)
		spread(sum,room);
	cout<<sum<<endl;
	return 0;
}


int judge(int x);
int main()
{
        int n,p,q,i,j,k;
        scanf("%d",&n);
        if(n<=4)
        {
                printf("empty");
        }
        else if(n<=6)
        {
                printf("3 5");
        }
        else if(n<=10)
        {
                printf("3 5\n5 7");
        }
        else
        {
                printf("3 5\n5 7\n");
                for(i=11,k=13;k<=n;i=i+2,k=k+2)
                {

                        p=judge(i);
                        q=judge(k);
                        if((q==0)&&(p==0))
                        {
                                printf("%d %d\n",i,k);
                        }
                }
        }

        return 0;

}

int judge(int x)
{
        int i=0,j;
        for(j=2;j<x;j++)
        {
                if(x%j==0)
                {
                        i=1;
                }
        }
        return i;
}


int is(int a)
{
    int sq=(int)sqrt(a);
    int i;
    for(i=2;i<=sq;i++)
    {
            if(a%i==0)
                 return 0;
    }
    return 1;
}

main()
{
      int n,m=0;
      scanf("%d",&n);
      for(int k=3;k<n-1;k++)
      {
              if(is(k)==1&&is(k+2)==1){
                  printf("%d %d\n",k,k+2);
                  m++;
              }
      }
      if(m==0){
               printf("empty");
      }}


 int sushu(int n)
{
      int i,j;
      for(j=0,i=2;i<=(int)sqrt(n);i++)
         {if(n%i!=0)
            {j=j+1;}
         }
         if(j>=(int)sqrt(n)-1)
            return(1);
         else return(0);

}
main()
{ int sushu(int n);
 int a,b,n,i,j;
 scanf("%d",&n);
if(n<=4) printf("empty");
else{
 for(i=2;i<=n-1;i++)
    {if(sushu(i)==1&&sushu(i+2)==1)
       {printf("%d %d\n",i,i+2);
         a+=1;
       }
    }
  }
}


int sushu(int i)
{
    int j,k;
    k=1;
    for(j=2;j<i;j++)
    {
                    if (i%j==0)
                    {
                          k=0;
                          break;
                    }
    }
    return k;
}

int main()
{
    int n,i,out;
    scanf("%d",&n);
    out=0;
    for (i=4;i<=n;i++)
    {
        if (sushu(i)&&sushu(i-2)) {printf("%d %d\n",i-2,i); out=1;}
    }
    if (out==0)
    {
               printf("empty");
    }
    return 0;
}


int Prime(int a)
{
	int i, j;
	j = 1;
	if (a <= 1)
		return 0;
	else if (a == 2 && a == 3)
		return 1;
	else if (a>3)
	{
		for (i = 2; i <= (a / 2); i++)
		{
			if (a%i == 0)
			{
				j = 0;
				break;
			}
		}
	}
	return j;
}
int main()
{
	int N;
	scanf("%d", &N);
	int a,b=0;
	for (a = 1; a <= N; a++)
	{
		if (Prime(a) == 1 && Prime(a - 2) == 1)
		{
			printf("%d %d\n", a-2,a);
			b++;
		}
	}
	if (b == 0)
		printf("empty\n");

}


int main()
{
	int sushu(int k);
	int n,i;
    cin>>n;
	if(n<5)
	{
		cout<<"empty"<<endl;
	}
	else
	{
	    for(i=2;i<n-1;i++)
		{
		     if(sushu(i)==1&&sushu(i+2)==1)
			 {
			       cout<<i<<' '<<i+2<<endl;
			 }
		}
	}
	return 0;
}

int sushu(int k)
{
	int t,j,l=0;
    if(k>2)
	{
	    for(j=2;j<k;j++)
		{
		     if(k%j==0)
			 {
			      l++;
			 }
		     else
			 {
			      l=l;
			 }
		}
	}
	else if(k==1||k==2)
	{
		l=0;
	}
	if(l==0) t=1;
	else  t=0;
	return(t);
}


int sushu(int x);
int main()
{
    int i=2,n,flag=0;
    scanf("%d",&n);
    for(i;i<=n;i++){
        if(sushu(i)&&sushu(i+2)&&i+2<=n){flag=1;printf("%d %d\n",i,i+2);}
}
	if(flag==0){printf("empty\n");}
    return 0;
}
    int sushu(int x){
        for(int p=2;p<x;p++){
            if(x%p==0){return 0;}
}
        return 1;
}


int prime(int n);
int main(){
	int a,b,i,n,num,mid,mid0,line1[1000],line2[1000];
	scanf("%d",&n);
	num=0;
	mid=0;
	for(i=3;i<n;i++){
		a=prime(i-2);
		b=prime(i);
		if(b-a==2){
			line1[num]=a;
			line2[num]=b;
			num++;
			mid++;
		}
	}
	if(n<5){
		printf("empty");
	}
	if(n==5){
		printf("3 5\n");
	}
	for(i=0;i<mid;i++){
		printf("%d %d\n",line1[i],line2[i]);
	}
	return 0;
}
int prime(int n){
	int i=0;
	for(i=2;i<n;i++){
		if(n%i==0){
			break;
		}
	}
	if(i==n){
		return n;
	}else{
		return 0;
	}
}


int sushu(int x);
int main(){
	int n,i,s[10000],k=0;
	scanf("%d",&n);
	for(i=3;i<=n;i++){
		if(sushu(i)){
			s[k]=i;
			k++;
		}
	}
	if(k==1){
		printf("empty");
	}else{
	for(i=0;i<k-1;i++){
		if(s[i+1]-s[i]==2){
			printf("%d %d\n",s[i],s[i+1]);
		}
	}
	}
	return 0;
}
int sushu(int x){
	int j;
	for(j=2;j<x;j++){
		if(x%j==0){
			return 0;
		}
	}
	return 1;
}


void main()
{
	int n,i,j=0,a[111111],k,m,s;
	scanf("%d",&n);
	if(n<5) printf("empty\n");
	else
	{
        for(m=2;m<=n;m++)
		{
			k=sqrt(m);
			for(i=2;i<=k;i++)
				if(m%i==0) break;
			if(i>k)
			{
				a[j]=m;j++;
			}
			else continue;
		}
	}
	s=j;
	for(j=0;j<=s;j++)
	{
		if(a[j+1]-a[j]==2) printf("%d %d\n",a[j],a[j+1]);
		else continue;
	}
}


main()
{
      int n=0;
      scanf("%d",&n);
      if(n<5)
        printf("empty");
      else
      {
      for(int i=3;i<=n-2;i++)
      {
           int j;
           for(j=3;j<i;j++)
           {
               if(i%j==0)
               break;
           }
           if(j==i)
           {
              int q;
              for(q=3;q<i+2;q++)
              {
                 if((i+2)%q==0)
                 break;
              }
              if(q==(i+2))
                printf("%d %d\n",q-2,q);
           }
      }
      }
      getchar();
      getchar();

}


int judge(int n)
{
	int i;
	for(i=2;i<n;i++)
	{
		if(n%i==0)
		{
			return(0);break;
		}
		if(i==n-1)
			return(1);
	}
	if(n==1)
		return(0);
	if(n==2)
		return(1);
}

void main()
{
	int n,i,j=0;
	scanf("%d",&n);
	for(i=1;i<n-1;i++)
		if(judge(i)&&judge(i+2))
			{printf("%d %d\n",i,i+2);j++;}
if(j==0)
printf("empty");
}


int sushu(int m);
int main()
{
    int n,y=0,i,a;
    scanf("%d",&n);
    if(n<5)printf("empty");
    else {
           printf("3 5\n");
           for(i=7;i<=n;i=i+2)
               if(sushu(i)==1&&sushu(i-2)==1)printf("%d %d\n",i-2,i);
          }
    return 0;
}
int sushu(int m){
    int p,q=1;
    for(p=3;p<=sqrt(m);p++){
        if(m%p==0){
           q=0;
           break;
           }
        }
    return q;
}


int sushu(int a)
{   int x=0;
	for(int i=2;i<a;i++)
	{
		if(a%i==0) x=1;
	}
	return x;
}
int main()
{
	int n,i,a,b,x,y,s=0;
	scanf("%d",&n);
	if (n<5) printf("empty\n");
	for (i=3;i<=n-2;i++)
	{
		a=i;
		b=i+2;
		x=sushu(a);
		y=sushu(b);
		if (x+y==0)
		{
			printf("%d %d\n",a,b);
			s=1;
		}
		if(s==0) printf("empty");
	}
	return 0;
}


int isprime(int n);
void main()
{
	int n,i,last_isprime=0,this_isprime,empty=1;
	scanf("%d",&n);
	for(i=3;i<=n;i+=2){
		this_isprime=isprime(i);
		if(last_isprime&&this_isprime){
			printf("%d %d\n",i-2,i);
			empty=0;
		}
		last_isprime=this_isprime;
	}
	if(empty) printf("empty\n");
}
int isprime(int n)
{
	int i;
	if(n==3) return 1;
	for(i=3;i<n;i+=2)
		if(n%i==0) return 0;
	return 1;
}


int sushu(int x)
{
	int i,k;
	k=sqrt(x);
	for(i=2;i<=k;i++)
		if(x%i==0)
			return 0;
	return 1;
}
main()
{
	int a,i,j;
	scanf("%d",&a);
	if(a<5) printf("empty");
	else for(i=3;i<=a-2;i++)
	{
		j=0;
		j=sushu(i)+sushu(i+2);
		if(j==2) printf("%d %d\n",i,i+2);
	};
}


int f(int a)
{
    int i,c;
    int count=0;
    for(i=1;i<=a;i++)
    {
        c=a%i;
        if(c==0)
        count=count+1;
    }
    if(count==2)
    return 1;
    else
    return 0;
}
int main()
{
    int n,i,j,c,d;
    scanf("%d",&n);
    if(n>=5)
    {
        n=n-2;
        for(i=1;i<=n;i++)
        {
            j=i+2;
            c=f(i);
            d=f(j);
            if(c==1&&d==1)
            printf("%d %d\n",i,j);
        }
    }
    else
    printf("empty");
    return 0;
}


int sushu(int x);
int main()
{
int n,p,q=0;
scanf("%d",&n);
for(p=4;p<=n;p++)
    {
     if( sushu(p)==1 && sushu(p-2)==1) //??????????
       {
           printf("%d %d\n",p-2,p);
           q++;
       }
    }
if(q==0)
printf("empty");
return 0;
}

int sushu(int x)
{
        int i,jsq,m;
        m=(int)sqrt(x);
        //jsq=0;

        for(i=2;i<=m;i++)
        {
           if(x%i==0)
           return 0;
        }
        return 1;
}


int sushu(int x)
{
int i;
int n;
int k;
int re;
n=x;
k=0;
for(i=1;i<=n;i++)
	{
      if(x%i==0)
		  k++;
	}
if(k==2)
re=1;
else
re=0;
return re;
}
int main()
{

	int n;
	int k=0;
	int i;
	scanf("%d",&n);
for(i=1;i<=n-2;i=i+2)
{
if(sushu(i)==1&&sushu(i+2)==1)
{
printf("%d %d\n",i,i+2);
k=k+1;
}
}
if(k==0)
printf("empty");
	return 0;
}


void main()
{
	int n,i,s=0;
	scanf("%d",&n);
	int f(int x);
	for(i=4;i<=n;i++)
	{
		if(f(i-2)==1&&f(i)==1)
		{
			printf("%d %d\n",i-2,i);
			s=s+1;
		}
	}
	if(s==0)
		printf("empty\n");

}
int f(int x)
{
	int i;
	if(x==2) return 1;
	for(i=2;i<=sqrt(x);i++)
	{
		if(x%i==0)
			break;
	}
	if(i>sqrt(x)) return 1;
	else return 0;
}


int main()
{
    int j,k,l,n,i;
    scanf("%d",&n);
    j=2;
    k=2;
    if(n>=5)
    {
       for(l=3;l<=n;l++)
       {
          for(i=2;i<l;i++)
          {
             if(l%i==0)
               break;
          }
          if(i==l)
          {
             j=k;
             k=l;
             if(k-j==2)
                printf("%d %d\n",j,k);
          }
       }
    }
    else
    printf("empty");
    return 0;
}


int sushu(int x)
{
	int i;
	int j=0;
	for(i=2;i<=x/2;i++)
		if(x%i==0)
			j=j+1;
		if(j==0)
			return 1;
		else
			return 0;
}
void main()
{
	int n;
	int i;
	int j=0;
	scanf("%d",&n);
	for(i=3;i<n-1;i=i+2)
		if(sushu(i)==1&&sushu(i+2)==1)
		{
			j=j+1;
			printf("%d %d\n",i,i+2);
		}
		if(j==0)
			printf("empty");
}


int find(int x)
{
    int i,BL=1;
    for (i=2;i<=sqrt(x);i++)
    {
        if (x%i==0)
            BL=0;
    }
    return BL;
}
main()
{
    int n,a=0,b=0,i,BL,c=0;
    scanf("%d",&n);
    for (i=3;i<=n;i+=2)
    {
        BL=0;
        if (find(i))
        {
            if (a<b)
                a=i;
            else
                b=i;
            BL=1;
        }
        if (a-b==2 && BL)
        {
            printf("%d %d\n",b,a);
            c=1;
        }
        else
        {
            if (b-a==2 && BL)
            {
                printf("%d %d\n",a,b);
                c=1;
            }
        }
    }
    if (c==0)
        printf("empty\n");
}


int su ( int x2 )
{
   int i ,x;
   x = x2/2;
   for ( i = 3 ; i < x ; i ++ )
    if ( x2 % i == 0 )
     return 0;
   return 1;
}

int main ()
{
   int n , i , f=1 , x1=3 , x2=5;
   scanf ( "%d" , &n );
   for ( ; x1 < n ; x1 = x2 )
    for ( x2 = x1 + 2 ; x2 <= n ; x2 += 2 )
     if ( su (x2) )
      {
       if ( x2 == x1 + 2 )
        { printf ( "%d %d\n" , x1 , x2 ); f = 0; }
       break;
      }
   if ( f )
    printf ( "empty" );
  // getchar (); getchar ();
   return 0;
}


int sushu(int x)
{
	int i,t=1;
	for(i=2;i<x;i++)
	{
		if(x%i==0)
		{
			t=0;
		}
	}
	return t;
}
int main()
{
	int i,n,a,b,t=0;
	scanf("%d",&n);
	for(i=4;i<=n;i++)
	{
		a=i-2;
		b=i;
		if(sushu(a)&&sushu(b))
		{
			t=1;
			printf("%d %d\n",a,b);
		}
	}
	if(t==0)
	{
		printf("empty");
	}
	return 0;
}


int prime(int a)
{
	int i;
	for(i=2;i<=a/2;i++)
	    if(a%i==0) return 1;
	return 0;
}

main()
{
	int n,i,a=0;
	scanf("%d",&n);
	for(i=2;i<=n-2;i++)
	{
		if(prime(i)==0&&prime(i+2)==0)
		{printf("%d %d\n",i,i+2);a++;}
	}
	if(a==0) printf("empty");
}


void main()
{
	int n,m,i,j=1;
	int *primeNum;
	int	Nprime=0;
	scanf("%d",&n);
	primeNum=(int*)malloc(sizeof(int)*n);
	if(n==1) printf("empty");
	if(n==2) printf("empty");
	if(n==3) printf("empty");
	if(n==4) printf("empty");
	if(n>=5)
	{
		for(m=2;m<=n;m++)
		{
			for(i=2;i<m;i++)
				if(m%i==0) break;
			if(m<=i)
			{
				*(primeNum+Nprime)=m;
				Nprime=Nprime+1;
			}
		}
	    for(j=1;j<Nprime;j++)
		{
			if(*(primeNum+j+1)-*(primeNum+j)==2) printf("%d %d\n",*(primeNum+j),*(primeNum+j+1));
		}
	}
}


int checkprime(int af)
{
	int i;
	for (i=2;i<(af);i++)
	{
		if (af%i==0)
			return 0;
	}
	return 1;
}
int main(int argc, char* argv[])
{
	int a,n,i;
	scanf("%d",&n);

	a=0;
	for(i=2;i<n-1;i++)
	{
		if (checkprime(i)==1&&checkprime(i+2)==1)
		{
			printf("%d %d\n",i,i+2);
		a++;
		}}
if(a==0)
printf("empty");
	return 0;
}


main()
{
	int n,a,b,k,p;
	scanf("%d",&n);
	if(n<=4)
	printf("empty");
	for(k=3;k<=n-2;k=k+2)
	{
		for(a=2;a<=sqrt(k);a++)
		if(k%a==0)
		break;
	    if(a>sqrt(k))
	    p=k+2;
	    for(b=2;b<=sqrt(p);b++)
		if(p%b==0)
		break;
		if(b>sqrt(p))
	    printf("%d %d\n",k,p);
	}
}


int main()
{
	int n,i,m,k,cp=2,count=0;

	scanf("%d",&n);
	for(m=3;m<=n;m=m+2)
	{

		k=sqrt(m);
		for(i=2;i<=k;i++)
			if(m%i==0)break;
			if(i>=k+1)
			{
				if(m-2==cp&&m!=3)
				{printf("%d %d\n",cp,m);count++;
				}
				cp=m;

			}

	}
	if(count==0)printf("empty");
}


int main()
{
    int spp(int p);
    int n,i;
    scanf("%d",&n);
    if(n<=4) printf("empty");
    else
    {
        for(i=2;i<n;i++)
        {
            if(spp(i)==0)
            {
                if(spp(i+2)==0) printf("%d %d\n",i,i+2);
                else continue;
            }
        }
    }
    return 0;
}
int spp(int p)
{
    int j,k=0;
    for(j=2;j<p;j++)
    if(p%j==0) k=1;
    return(k);
}


int judge(int x){
	int i;
	if(x%2==0) return 0;
	for(i=3;i<=sqrt(x);i+=2){
		if(x%i==0) return 0;
	}
	return 1;
}

void main(){
	int i,n,k=0;
	scanf("%d",&n);
	for(i=2;i<=n-2;i++){
		if(judge(i)==1&&judge(i+2)==1){
			printf("%d %d\n",i,i+2);
			k++;
		}
	}
	if(k==0) printf("empty\n");
}


int isSUSHU (int x);
int main (){
   int n,i,j;
   int sz[LEN][2];
   scanf("%d",&n);
   j=0;
   for(i=2;i<=(n-2);i++){
	   if (isSUSHU(i)){
		  if(isSUSHU(i+2)){
		    sz[j][1]=i;
			sz[j][2]=i+2;
			j++;
		  }
	   }
   }
   if(j==0){
    printf("empty");
   }
   else{
     for(i=0;i<j;i++){
      printf("%d %d\n",sz[i][1],sz[i][2]);
	 }
   }
return 0;
}
int isSUSHU (int x){
  int z;
  for(z=(x-1);z>=1;z--){
	  if(x%z==0){
	    break;
	  }
  }
  if(z==1){
    return 1;
  }
return 0;
}


int func(int a,int b)
{
	int i,flag=1;
	for(i=2;i<=sqrt(a);i++){
		if(a%i==0){
			flag=0;
			break;
		}
	}
	for(i=2;i<=sqrt(b);i++){
		if(b%i==0){
			flag=0;
	     	break;
		}
	}
	return flag;
}

int main()
{
	int sum=0,n,i;
	scanf("%d",&n);
	for(i=1;i<=n-2;){
		if(i==1){
			i=i+2;
			continue;
		}
		if(func(i,i+2)==1){
			sum++;
			printf("%d %d\n",i,i+2);
		}
		i=i+2;
	}
	if(sum==0)
		printf("empty\n");
	return 0;
}


int find(int n)
{
	int i;
	for (i=2;i<=sqrt(n);i++)
		if (n%i==0)
			return 0;
	return 1;
}

int main()
{
	int a[1000000],i,j=0,n,s=0,ok=1;
	memset(a,0,sizeof(a));
	scanf("%d",&n);
    for (i=1;i<=n;i++)
		if (find(i))
			a[j++]=i;
	for (i=0;i<j;i++)
		if (a[i+1]-a[i]==2)
		{printf("%d %d\n",a[i],a[i+1]);s++;ok=0;}
	if (s==0)
	{printf("empty");ok=0;}
	if (ok)
		printf("^");

	return 0;
}


int main()
{
	int n,q=0;
	int judge(int x);
	scanf("%d",&n);
	for(int i=3;i<=n-2;i+=2)
		if (judge(i)&&judge(i+2))
		    {
			printf("%d %d",i,i+2);
			q=1;
			printf("\n");
			}
	if(q==0)
	   printf("empty");
}
int judge(int x)
{
	int p=1;
	for(int i=2;i<=sqrt((double)x);i++)
	    if(x%i==0)
	       {
		   p=0;
		   break;
		   }
	if(p==1)
	   return 1;
	else
	   return 0;
}


int main()
{
	int sushu(int n,int a[10000]);
	int n,i,array[10000],m,p;
	scanf("%d",&n);
	m=sushu(n,array);
	for(i=0,p=0;i<m;i++)
	{
		if(array[i]==array[i+1]-2) {printf("%d %d\n",array[i],array[i+1]);p++;}
	}
	if(p==0) printf("empty\n");
}
int sushu(int n,int a[10000])
{
	int i,j,number=0;
	for(i=3;i<=n;i=i+2)
	{
		for(j=3;j<=sqrt(i);j=j+2)
		{
			if(i%j==0){break;}
		}
		if(j>sqrt(i)) {number=number+1;a[number]=i;}
	}
	return(number++);
}


int main()
{
	int n,i;
	scanf("%d",&n);
	if(n==1)
		printf("empty");
	else
		if(n==2||n==3||n==4)
		printf("empty");
		else
		{
	for(i=3;i<=n-2;i++)
	{
		for(int j=2;j<i;j++)
		{
			int c;
			c=i%j;
			if(c==0)
				goto part1;
		}
		for(int j=2;j<i+2;j++)
		{
			int c;
			c=(i+2)%j;
			if(c==0)
				goto part1;
		}
		printf("%d %d\n",i,i+2);
part1:;
	}
		}
	return 0;
}


int check (int a)
{
	int i;
	double k;
	k=sqrt(a);
	for (i=2; i<=k; i++)
		if (a%i==0) break;
	if (i>k) return 1;
	else return 0;
}
int main ()
{
	int n, i;
	scanf ("%d", &n);
	if (n<=4) printf ("empty");
	for (i=3; i+2<=n; i=i+2)
		if (check(i)==1 && check(i+2)==1)
			printf ("%d %d\n", i, i+2);
	return 0;
}


int sushu(int n)
{
	int i,k=1;
	for(i=2;i<n;i++)
	{
		if(n-(n/i)*i>0)
			k=k*1;
		else k=k*0;
	}
	return(k);
}
void main()
{
	int n,i,k=0;
	scanf("%d",&n);
	for(i=5;i<=n;i++)
	{
		if((sushu(i)>0)&&(sushu(i-2)>0))
		{
			printf("%d %d\n",i-2,i);
			k=k++;
		}
	}
	if(k==0)
		printf("empty");
}


void main( )
{
	int n,i,k=0;
    int f(int a);
	scanf("%d",&n);
	for(i=3;i<n-1;i++)
	{if((f(i)==0)&&(f(i+2)==0))
	{printf("%d %d\n",i,i+2);
	k++;}
	}
	if(k==0)printf("empty");
}
int f(int a)
{
	int b=sqrt(a);
	int i,sum=0;
	for(i=2;i<=b;i++)
		if(a%i==0)
		{sum=1;break;}
		return(sum);
}


int sushu(int i)
{
    int j,y;
    y=0;
    for(j=2;j<i;j++)
    {
                     if(i%j==0)
                     {

                     y=1;
                     break;
                     }
                     }
                     if(y==0)
                     return(1);
                     else
                     return(0);
                     }

main()
{
      int sushu(int i);
      int n,i,a,b,x;
      x=0;
      scanf("%d",&n);

      for(i=2;i<=n-2;i++)
      {
                       a=sushu(i);
                       b=sushu(i+2);

                        if(a==1&&b==1)
                        {
                       printf("%d %d\n",i,i+2);
                       x=1;
                       }
                       }
                       if(x==0)
                       printf("empty");

                       }


int main()
{
	int a,b,n,k,i,j,t;
	scanf("%d",&n);
	t=0;
	for(a=2;a<=n;a++)
	{
	k=sqrt(a);
	for(i=2;i<=k;i++)
		if(a%i==0)break;
		if(a%i==0)continue;
	if(i>=k+1)
		b=a+2;
	if (b<=n)
	{
		k=sqrt(b);
	for(j=2;j<=k;j++)
	if(b%j==0)break;
	if(j>=k+1)
	{printf("%d %d\n",a,b);
	t=t+1;
	}
	}
	}
	if(t==0)
		printf("empty\n");
return 0;
}


struct couple
{
	int a;
	int b;
	int ans;
}c[M];
int vege(int k)
{
	int i,ans=1;
	if(k==2||k==3)
		ans=1;
	else
	{
		for(i=2;i<k;i++)
		{
			if(k%i==0)
			{
				ans=0;
				break;
			}
		}
	}
	return ans;
}
int main()
{
	int n,i,j=0,flag=0;
	scanf("%d",&n);
	for(i=2;i<=n-2;i++)
	{
		int ans;
		ans=vege(i);
		if(ans==1)
		{
			c[j].a=i;
			c[j].b=i+2;
			c[j].ans=vege(c[j].b);
			j++;
		}
	}
	for(i=0;i<j;i++)
	{
		if(c[i].ans==1)
		{
			flag=1;
			break;
		}
	}
	if(flag==0)
		printf("empty\n");
	else
	{
		for(i=0;i<j;i++)
		{
			if(c[i].ans==1)
			printf("%d %d\n",c[i].a,c[i].b);
		}
	}
	return 0;
}


int judgeprime(int x);
int main()
{
	int input;
	int counter=0;
	scanf("%d",&input);
	int i2;
	for (i2=2;i2<=(input-2);i2++)
	{
		if (judgeprime(i2)&&judgeprime(i2+2))
		{
			printf("%d %d\n",i2,i2+2);
			counter++;
		}
	}
	if (0==counter)
	{
		printf("empty");
	}
	return 0;
}

int judgeprime(int x)
{
	int i1;
	int flag_prime=1;
	if (2==x)
	{
		flag_prime=1;
	}
	for (i1=2;i1<=sqrt((float)x)+1;i1++)
	{
		if (0==x%i1)
		{
			flag_prime=0;
		}
	}
	if (0==flag_prime)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}


int sushu(int a)
{
	int i,k;
	k=sqrt(a);
	for(i=2;i<=k;i++)
		if(a%i==0)
			break;
	if(i>k) return 1;
	else return 0;
}

void main()
{
	int n,i,mark=0;
	scanf("%d",&n);
	for(i=3;i<n;i=i+2)
	{
		if(sushu(i)==1)
		{
			if(i+2>n)
				break;
			else if(sushu(i+2)==1)
			{
				printf("%d %d\n",i,i+2);
				mark=1;
			}
		}
	}
	if(mark==0)
		printf("empty");
}


int main(){
int n,i,a,b,m=0;
scanf("%d",&n);
for(a=3;a<=n-2;a++){
	for(i=2;i<=sqrt(a);i++){
		if(a%i==0){
		break;
		}
	}
	if(i>sqrt(a)){
	b=a+2;
	}else{
	continue;
	}
	for(i=2;i<=sqrt(b);i++){
		if(b%i==0){
		break;
		}
	}
	if(i>sqrt(b)){
	printf("%d %d\n",a,b);
	m=1;
	}
}
if(m==0){
printf("empty");
}
return 0;
}


int ip(int n);
int opp(int n);
int ip(int n){
  int k,s;
  if(n==2){
	  return 1;
  }else if(n%2==0){
     return 0;

  }
  s=(int)sqrt((double)n);
  for(k=3;k<=s;k+=2){
	  if(n%k==0){
	    return 0;
	  }

  }
  return 1;
}

int main(){
	int n,i,t=0;
	scanf("%d",&n);
	for(i=3;i<n-1;i=i+2){
		if(ip(i)&&ip(i+2)){
		    printf("%d %d\n",i,i+2);
			t=1;

		}

	}
	if(t==0){
	   printf("empty");

	}
   return 0;
}


int prime(int n)
{
    int i,a;
    {for(i=2;i<=sqrt(n);i++)
       if(n%i==0){a=0;break;}
    if(i>sqrt(n))a=1;}
    return a;
}
int main()
{
    int n,i;
    scanf("%d",&n);
    if(n<5)printf("empty");
    else printf("3 5");
    for(i=5;i+2<=n;i+=2)
    if(prime(i)*prime(i+2)==1)
    printf("\n%d %d",i,i+2);

}


int sushu(int x)
{
	int i=2;
	int j;
	if(x<=1)
		return 0;
	else
	{
		j=0;
       while(i<=x/2)
	   {
		  if(x%i==0)
		   j++;
		   i++;
	   }
	   if(j==0)
	       return 1;
	   else
		   return 0;
	}
}
void main()
{
	int n;
	int i=1;
	int k=0;
	scanf("%d",&n);
	while(i<n-1)
	{
		if((sushu(i)==1)&&(sushu(i+2)==1))
		{
		printf("%d %d\n",i,i+2);
		k++;
		}
		i=i+2;
	}
	if(k==0)
		printf("empty");
}


int sushu(int x);
int main(){
	int n,j,m=0;
	scanf("%d",&n);
	for(j=3;j<=n-2;j=j+2){
        if(sushu(j)&&sushu(j+2)){
		   printf("%d %d\n",j,j+2);
		   m++;
		}
	}
	if(m==0)
		printf("empty");

	return 0;

}
int sushu(int x){
	int i;
	for(i=2;i<=sqrt(x);i++){
        if(x%i==0)
			return 0;
	}
	return 1;
}


void print(int a)
{printf("%d %d\n",a,a+2);
}

int search(int b)
{int i=2,j=1;
for(i=2;i<=sqrt(b);i++)
{if(b%i==0)
{j=0;break;}
}
return(j);
}

void main()
{
int n;
scanf("%d",&n);
int i=2,sum=0;
for(i=2;i<=n-2;i++)
{if(search(i)==1&&search(i+2)==1)
{print(i);sum++;}
}
if(sum==0)
{printf("empty");}
}


int main()
{
	int sz[10000];
	int i;
	int n;
	int num;
	int count=0,order=1;
	scanf("%d",&n);
	sz[0]=2;
	for(num=3;num<n+1;num=num+2)
	{
		for(i=2;i<num;i++)
		{
			if(num%i==0)
			{
				break;
			}else{
				count++;
			}
		}
		if(count==num-2)
		{
			sz[order]=num;
			order++;
		}
		count=0;
	}
	int flag=0;
	for(i=0;i<order-1;i++)
	{
		if(sz[i]+2==sz[i+1])
		{
			printf("%d %d\n",sz[i],sz[i+1]);
			flag=1;
		}
	}
	if(flag==0)
	{
		printf("empty\n");
	}
	return 0;
}


main()
{
      int n,now,i,j,ok,ok2;

      scanf("%d",&n);
      now=2; ok2=0;
      if (n>2)
      {
              for (i=3;i<=n;i++)
              {
                     ok=1;
                     for (j=2;j<=(int)(sqrt(i));j++)
                         if (i%j==0)
                         {
                             ok=0;
                             break;
                         }
                     if (1==ok)
                     {
                         if (2==i-now)
                         {
                             printf("%d %d\n",now,i);
                             if (0==ok2)
                                 ok2=1;
                         }
                         now=i;
                     }
              }
              if (0==ok2)
                  printf("empty\n");
      }
      else
          printf("empty\n");
      return 0;
}


int f(int x)
{
	int i,tag=1;
	if(x==2)return 1;
	else if(x==1)return 0;
	else
	{
		for(i=2;i<x;i++)
         if(x%i==0)
		 {tag=0;break;}
		 return tag;
	}
}
void main()
{
	int n,i,num=0;
	scanf("%d",&n);
	for(i=2;i<=n-2;i++)
		if(f(i)&&f(i+2))
		{printf("%d %d\n",i,i+2);num++;}
		if(num==0)
			printf("empty\n");
}


int sushu(int n){
	int m=(int)sqrt(n),i;
	for(i=3;i<=m;i++){
		if(n%i==0){
			return 0;
		}
	}
	return 1;
}
int main(int argc, char* argv[])
{
	int n,i,num=0;
	scanf("%d",&n);
	for(i=3;i<=n-2;i+=2){
		if(sushu(i)==1&&sushu(i+2)==1){
			printf("%d %d\n",i,i+2);
			num++;
		}
	}
	if(num==0){
		printf("empty");
	}
	return 0;
}


int isPrime(int n)
{
   int sum=0;
   for(int i=2;i<n;i++){
       if(n%i==0){
          return 0;
          sum++;
          break;
       }
   }
   if(sum==0) return 1;
   else return 0;
}
int main()
{
  int n, x, flag=0;
  scanf("%d",&n);
  for(x=3;x<n-1;x+=2)
  {
	if(isPrime(x)&&isPrime(x+2))
	   {
		printf("%d %d\n",x,x+2);
		flag++;
	}
  }
  if(!flag) printf("empty\n");
  return 0;
}


char pure(int n,int a[],int topnum,int topcheck);

main ()
{
     int n,i,j;
     scanf("%d",&n);
     if (n<=4) printf("empty");
     else
     {
         int a[1300];
         int topnum,topcheck;
         a[0]=3;
         topnum=0;topcheck=2;
         for (i=5;i<=n;i=i+2)
         {
             if (topcheck*topcheck<=i) topcheck++;
             if (pure(i,a,topnum,topcheck))
             {
                topnum++;
                a[topnum]=i;
                if (a[topnum]==a[topnum-1]+2)
                   printf("%d %d\n",a[topnum-1],a[topnum]);
             }
         }
     }
}

char pure(int n,int a[],int topnum,int topcheck)
{
     for (int i=0;i<=topnum;i++)
     {
         if (a[i]==topcheck) break;
         if (n%a[i]==0) return 0;
     }
     return 1;
}


void main()
{
	int n,i,j,k,flag=0,flag2=0;

	scanf("%d",&n);
	for(i=3;i+2<=n;i++)
	{
		flag=0;
		for(j=2;j<i;j++)
			if(i%j==0)
			{
				flag=1;
				break;
			}
		for(k=2;k<i+2;k++)
			if((i+2)%k==0)
			{
			    flag=1;
				break;
			}

		if(flag==1)
			continue;
		printf("%d %d\n",i,i+2);
		flag2=3;
	}
	if(flag2!=3)  printf("empty\n");
}


int main(int argc, char* argv[])
{	int flag,count,n,i,j,k[100000],flagg;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	k[i]=0;

	i=2;count=0;flag=0;
	while(i<=n)
	{
		for(j=2;j<=i-1;j++)
		{
			if(i%j==0)
			{
				flag=1;
				break;
			}
			if(i%j!=0)
				flag=0;
		}
		if(0==flag)
		{
			k[count]=i;
			count++;
		}
		i++;
	}
	flagg=0;
	for(i=0;i<=count;i++)
	{
		if(k[i]==k[i+1]-2)
		{
			printf("%d %d\n",k[i],k[i+1]);
			flagg=1;
		}
	}
	if(flagg==0)
			printf("empty\n");
	return 0;
}


int f(int a)
{
	int i,k;
	k=sqrt(a);
	for(i=2;i<=k;i++)
		if(a%i==0)
			break;
		if(i>=k+1)
			return(1);
			else
				return (0);
}
void main()
{
	int n,a[1500],i,j=0,k=0,flag=1;
	scanf("%d",&n);
	for(i=2;i<=n;i++)
		if(f(i))
		{
			a[j]=i;
			j++;
		}
		for(k=1;k<j;k++)
			if(a[k]+2==a[k+1])
			{
				printf("%d %d\n",a[k],a[k+1]);
				flag=0;
			}
			if(flag)
				printf("empty\n");
}


int f(int a,int b)
{
	int k1,k2;
	int i,j;
	k1=sqrt(a);
	for(i=2;i<=k1;i++)
		if(a%i==0)
			break;
	k2=sqrt(b);
	for(j=2;j<=k2;j++)
		if(b%j==0)
			break;
	if(i>=k1+1&&j>=k2+1)
		return(1);
	else
		return(0);
}
void main()
{
	int n;
	int p=0,i,q=0;
	scanf("%d",&n);
	for(i=3;i<=n-2;)
	{
		p=f(i,i+2);
		if(p==1)
		{
			printf("%d %d\n",i,i+2);
			q++;
		}
		i=i+2;
	}
	if(q==0)
		printf("empty\n");
}


int prime(int i)
{
    int j;
    int output = 0;
    int count = 0;

    if(i == 1 || i == 2)
         output = 0;
    else
    {
    for(j = 1; j <= i; j++)
          if((i / j) * j == i)
               count++;

    if(count == 2)
             output = 1;
    }

    return output;
}

int main()
{
    int n;
    scanf("%d", &n);
    int count = 0;
    int i;
    for(i = 3; i <= n - 2; i = i + 2)
    {
          if(prime(i) == 1 && prime(i + 2) == 1)
          {
                      printf("%d %d\n", i, i + 2);
                      count++;
          }

    }
    if(count == 0) printf("empty");

    return 0;
}


int f(int x){
	int i,num=0;
	for(i=1;i<=x;i++){
		if(x%i==0) num++;
	}
	if(num==2) return 1;
	else return 0;
}

int main(){
	int i,n,e=2,num=0;
	scanf("%d",&n);
	for(i=2;i<=n;i++){
		if(f(i)&&i==e+2){
			printf("%d %d\n",e,i);
			num++;
		}
		if(f(i)) e=i;
	}
	if(num==0) printf("empty");
	return 0;
}


int sushu(int a);

int main()
{
	int n,i,j=0,m=0;
	int sz[10000];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(sushu(i))
		{
			sz[j]=i;
			j++;
		}
	}
	for(i=0;i<j;i++)
	{
		if(sz[i+1]-sz[i]==2)
		{
			m++;
			printf("%d",sz[i]);
			printf(" %d\n",sz[i+1]);
		}
	}
	if(m==0)
	{
		printf("empty\n");
	}

	return 0;

}
int sushu(int a)
{
	int i,e=0;
	for(i=1;i<a;i++)
	{
		if(a%i==0)
		{
			e++;
		}
	}
	if(e==1)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}


int main()
{
	int n,i,sum=0;
	int f (int i);
	scanf("%d",&n);
	for (i=1;(i+2)<=n;i++)
	{
		if (f(i)){
			printf("%d %d\n",i,i+2);
			sum++;
		}
	}
	if (sum==0) printf("empty");
	return 0;
}

int f (int i){
	int s (int i);
	if (s(i)&&s(i+2))
		return (i);
	else return (0);
}

int s(int n){
	int k,num=0;
	for (k=1;k<=n;k++){
		if (n%k==0) num++;
	}
	if (num==2) return (n);
	else return (0);
}


int ifsu(int i)
{
	int temp=0,j;
	for(j=2;j<i;j++)
	{
		if(i%j==0)
			temp++;
	}
	if(temp==0)
		return 1;
	else return 0;
}
void main()
{
	int n,a[5000]={0},time=0,i,j,temp=0;
	scanf("%d",&n);
	j=0;
	for(i=2;i<=n;i++)
	{
		if(ifsu(i)==1)
		{
		a[j]=i;time++;
		j++;}

	}

	for(i=1;i<time-1;i++)
	{
		if(a[i]==(a[i+1]-2))

		printf("%d %d\n",a[i],a[i+1]);
		temp++;

	}
	if(temp==0)
		printf("empty");
}


int sushu(int x)
{
    int i;
    for (i=2;i<x;i++)
    {
        if (x%i==0) break;
    }
    if (i==x) return 1;
    else return 0;
}
int main ()
{
    int n,a=0;
    scanf("%d",&n);
    for (int j=4;j<=n;j++)
    {
        if((sushu(j-2)==1)&&(sushu(j)==1))
        {
            printf("%d %d\n",j-2,j);
            a++;
        }
    }
    if (a==0) printf("empty");
    return 0;
}


int sushu(int i);
int main ()
{
	int n,i,j=0;
	scanf("%d",&n);
	for(i=4;i<=n;i++)
	{
		if(sushu(i) && sushu(i-2))
		{
			j++;
			printf("%d %d\n",i-2,i);
		}

	}
	if(j==0)
		printf("empty");

	return 0;
}
int sushu(int i)
{
	int n,sj=0;
	for(n=2;n<i;n++)
	{
		if(i%n==0)
			sj=1;
	}
	if(sj==1)
	{
		return 0;
	}
	else return 1;
}


int prime(int x);
int main()
{
	int n,i;
	int timer=0;
	scanf("%d",&n);
	for(i=3;i<=n-2;i++)
	{
		if(prime(i))
		{
			if(prime(i+2))
			{
				printf("%d %d\n",i,i+2);
				timer++;
			}
		}
	}
	if(timer==0)
	{
		printf("empty");
	}
	return 0;
}
int prime(int x)
{
	int echo,i;
	for(i=2;i<=x;i++)
	{
		if(x%i==0)
		{
			break;
		}
	}
	if(i==x)
	{
		echo=1;
	}
	else
	{
		echo=0;
	}
	return echo;
}


int issushu(int x);
int main()
{
	int n,i,flag=0;

	scanf("%d",&n);
	for(i=1;i<=n-2;i++)
	{
		if(issushu(i)&&issushu(i+2))
		{
			printf("%d %d\n",i,i+2);
			flag=1;
		}
	}
	if(flag==0) printf("empty");

	return 0;
}

int issushu(int x)
{
	int j;
	if(x<2) return 0;
	else if(x==2) return 1;
	else
	{
		for(j=2;j<x;j++)
		{
			if(x%j==0) return 0;
		}
	}
	return 1;
}


int zhi(int a);
int main(){
int n,i,t,k;
k=0;
scanf("%d",&n);
for(i=3;i<=n-2;i++){
	if(zhi(i)==1){
		t=i+2;
		if(zhi(t)==1){
			k++;
			printf("%d %d\n",i,t);
		}
	}
}
if(k==0){
	printf("empty\n");
}
	return 0;
}
int zhi(int a){
	int b=1;
	for(int i=2;i<a;i++){
		if(a%i==0){
			break;
		}else{
			b++;
		}
	}
	if(b==a-1){
		return 1;
	}else{
		return 0;
	}
}


int f(int x){
	int i,z=1;
	if(x==2)return 1;
	else {
		for(i=2;i<x;i++){
			if(x%i==0){z=0;
			break;}
		}
	}
	return z;
}
int main(int argc, char* argv[])
{	int n;
	scanf("%d",&n);
int z=0;
	int i,o=0;
	int a[10000];
	for(i=2;i<=n;i++){
		if(f(i)==1){
		a[o]=i;
		o++;
	}
	}

	for(i=0;i<o;i++)
	{if(a[i]+2==a[i+1]){
		printf("%d %d\n",a[i],a[i+1]);
		z=1;
	}

	}

if(z==0) printf("empty");

	return 0;
}


main()
{
      int i,j,n;
      scanf("%d",&n);
      i=1;
      j=0;
      while(i<=n)
      {
                 if(isprime(i)==1&&isprime(i+2)==1&&i+2<=n)
                 {printf("%d %d\n",i,i+2);
                 j++;}
                 i=i+2;
                 }
      if(j==0)
      printf("empty");

        }
int isprime(int a)
{
    int j=2;
    while(j<a&&a%j!=0)
    {
               j++;
               }
               if (j==a)
               return 1;
               else
               return 0;
               }


void main()
{
	int n,s=0,i;
	scanf("%d",&n);
	int isPrime(int i);
	for(i=3;i<=n-2;i++)
	{
		if(isPrime(i)&&isPrime(i+2))
		{
			printf("%d %d\n",i,i+2);
			s++;
		}
	}
	if(s==0)printf("empty\n");
}
int isPrime(int i)
{
	int j;
	for(j=2;j<i;j++)
	{
		if(i%j==0)
		{
			return 0;
		}

	}
	return i;
}


int main()
{
    int n,i,j,k;
    scanf("%d",&n);
    if(n<=4)
    printf("empty");
    else
    {
        for(i=3;i<=n-2;i++)
        {
            for(j=2;j<=i-1;j++)
                if(i%j==0)break;
            if(j>i-1)
            {
                for(k=2;k<=i+1;k++)
                    if((i+2)%k==0)break;
                if(k>i+1)
                    printf("%d %d\n",i,i+2);
                else;
            }
            else;
        }
    }
    getchar();
    getchar();
}


int prime(int x)
{
	int j;
	for(j=2;j<x;j++)
    { if(x%j==0)  return 0;  }
	              return 1;
}
int prime(int x);
main()
{
	int n,a,b,x;
	scanf("%d",&n);
	if(n<5)
    printf("empty");
    else
    for(x=2;x<=n-2;x++)
    {
		a=prime(x);
		b=prime(x+2);
		if(a&&b)
			printf("%d %d\n",x,(x+2));
	}
}


int fun(int a)
{
    int sum,i;
    if(a==2||a==3)
    return 0;
  if(a>3)
  {
         for(sum=0,i=2;i<=sqrt(a);i++)
  {
      if(a%i==0)
      {
                sum++;
              break;
              }
              }
      return sum;
      }
}
int main()
{
    int n,i;
    scanf("%d",&n);
    if(n<5)
    {
           printf("empty");
           }
           if(n>=5){
    for(i=2;i<=n-2;i++)
    {
                      if(fun(i)==0)
                      {
                                   if(fun(i+2)==0)
                                   {
                                                  printf("%d %d\n",i,i+2);
                                                  }
                                                  }
                                                  }
                                                  }
                                                  return 0;
                                                  }


int main()
{
    int N;
    scanf("%d",&N);
    if(N>=5)
    {
           int check(int n);
    {
        int n;
        for(n=3;n<=N-2;n+=2)
        if(check(n)&&check(n+2))
        {
                                printf("%d %d\n",n,n+2);
        }
    }
    }
    else
    printf("empty");
}
int check(int n)
{
    int i;
    if(n==3) return 1;
    for(i=2;i<=n-1;i++)
    if(n%i==0)
    {
               return 0;
               break;
    }
    if(i<n)
    {
           return 0;
    }
    else
    {
           return 1;
    }
}


int sushu(int x)
{
    int i,a;
    for(i=2;i<x;i++)
    if(x%i==0)
    break;
    if(i==x)
          a=1;
    else
          a=0;
    return(a);
}
int main()
{
    int sushu(int x);
    int N,n;
    int Flag=0;
    scanf("%d",&N);
    {
        for(n=1;n<=(N-2);n++)
        if(sushu(n)==1)
        if(sushu(n+2)==1)
        {printf("%d %d\n",n,(n+2));
        Flag=1;}
    }
    if(Flag==0)
    printf("empty");
}


main()
{
	int n,m,i,j,k,l=0;
	scanf("%d",&n);
	n=n-2;
	for(i=2;i<=n;i++)
	{
		j=0;
		for(m =2;m <i;m ++)  /*panduan i shifou sushu*/
		{
			if(i%m==0)
				j++;
		}
	    if(j==0)  /*i shisushu*/
	    {
		    k=i+2;
			for(m =2;m <k;m ++)  /*panduan k shifou sushu*/
		    {
			if(k%m==0)
				j++;
		    }
			if(j==0)  /*k shisushu*/
			    {
				   printf("%d %d\n",i,k);
				   l++;   /*l zhaodao de sushudui shu*/
				}
		}

	}
	if(l==0)
	   printf("empty");
}


int S(int x)
{
    int i=2,a=0;
    while(i<x)
    {
           if(x%i==0)
           {
                     a=1;
                     break;
           }
           else
           i++;
    }
    return a;
}
main()
{
    int n,a=5,b,c,d=0;
    scanf("%d",&n);
    while(a<=n)
    {
               b=S(a);
               c=S(a-2);
               if(b==0&&c==0)
               {
               printf("%d %d\n",a-2,a);
               d++;
               }
               a++;
    }
    if(d==0)
    printf("empty");
    getchar();
    getchar();
}


int isPrime(int a)
{
    int i;
    for(i=2;i<a;i++)
    if(a%i==0)return 0;
    return 1;
}
int main()
{
   int n;
   scanf("%d",&n);
   int i,sum=0;
   for(i=3;i+2<=n;i++)
   if(isPrime(i)&&isPrime(i+2))
   {printf("%d %d\n",i,i+2);sum++;}
   if(sum==0)printf("empty");
   return 0;
}