#include <iostream>
using namespace std;
bool dp[110];
int checkprime(int x){
for (int i=2; i<x; i++){
if (x%i==0){
return false;
}
}
return true;
}
int main() {
//0 means next player to play win, 1 else
for (int i=4; i<101; i++){
if (checkprime(i)){
dp[i]=(dp[i-1]+dp[i-2]+dp[i-3]+dp[i-4]+dp[i-5]==0);
}
else{
dp[i]=(dp[i-1]+dp[i-2]+dp[i-3]==0);
}
}
for (int i=1; i<=100; i++){
cout<<i<<" "<<dp[i]<<endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKYm9vbCBkcFsxMTBdOwoKaW50IGNoZWNrcHJpbWUoaW50IHgpewoJZm9yIChpbnQgaT0yOyBpPHg7IGkrKyl7CgkJaWYgKHglaT09MCl7CgkJCXJldHVybiBmYWxzZTsKCQl9Cgl9CglyZXR1cm4gdHJ1ZTsKfQoKaW50IG1haW4oKSB7CgkvLzAgbWVhbnMgbmV4dCBwbGF5ZXIgdG8gcGxheSB3aW4sIDEgZWxzZQoJZm9yIChpbnQgaT00OyBpPDEwMTsgaSsrKXsKCQlpZiAoY2hlY2twcmltZShpKSl7CgkJCWRwW2ldPShkcFtpLTFdK2RwW2ktMl0rZHBbaS0zXStkcFtpLTRdK2RwW2ktNV09PTApOwoJCX0KCQllbHNlewoJCQlkcFtpXT0oZHBbaS0xXStkcFtpLTJdK2RwW2ktM109PTApOwoJCX0KCX0KCWZvciAoaW50IGk9MTsgaTw9MTAwOyBpKyspewoJCWNvdXQ8PGk8PCIgIjw8ZHBbaV08PGVuZGw7Cgl9Cn0=