/* client bidon - Royale */
#include <stdio.h>
#define COTE 20
int autre(int joueur)
{
if (joueur==1) return(2); else return(1);
}
int main(void)
{
int grille[COTE][COTE];
int joueur,x,y;
for (x=0;x<COTE;x++) for (y=0;y<COTE;y++) grille[x][y]=0;
scanf("%d",&joueur);
if (joueur==2)
{
scanf("%d %d",&x,&y);
grille[x-1][y-1]=1;
}
while (1==1)
{
while (grille[x=(rand() % COTE)][y=(rand() % COTE)]!=0);
grille[x][y]=joueur;
printf("%d %d\n",x+1,y+1); fflush(stdout);
scanf("%d %d",&x,&y);
grille[x-1][y-1]=autre(joueur);
}
return(0);
}