/*#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello world!\n");
return 0;
}*/
/*#include <stdio.h>
int main()
{
int a, b;
scanf("%d %d",&a, &b);
if(b==1||b==2)
{
printf("%d",2012-(a/10000+1900)+1);
}
else
{
printf("%d",2012-(a/10000+2000)+1);
}
return 0;
}*/
/*
#include <stdio.h>
int main()
{
int a, b, c, d;
scanf("%d %d %d %d",&a, &b, &c, &d);
if((double)a/b>(double)c/d)
{
printf(">");
}
else if((double)a/b==(double)c/d)
{
printf("=");
}
else if((double)a/b<(double)c/d)
{
printf("<");
}
return 0;
}*//*
#include <stdio.h>
int main()
{
int w;
scanf("%d",&w);
if(30<=w&&w<=40 || 60<=w&&w<=70)
{
printf("win");
}
else
{
printf("lose");
}
return 0;
}*/
/*#include <stdio.h>
int main()
{
int d;
scanf("%d",&d);
if(d%4==0 && d%100!=0 || d%400==0)
{
printf("yes");
}
else
{
printf("no");
}
return 0;
}*/
#include <stdio.h>
int main()
{
int g, h;
scanf("%d %d",&g, &h);
if(h%4==0 && h%100!=0 || h%400==0)
{
printf("%d %d",g )
}
}