#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int a,b=0,c;
cin>>c;
cout<<c<<endl;
do{
cin>>a;
cout<<a<<endl;
if(a==42&&c!=42)b+=1;
c = a;
}while(b!=3);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4gCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBhLGI9MCxjOwoJY2luPj5jOwoJY291dDw8Yzw8ZW5kbDsKCWRvewoJCWNpbj4+YTsKCQkKCQljb3V0PDxhPDxlbmRsOwoJCWlmKGE9PTQyJiZjIT00MiliKz0xOwoJCWMgPSBhOwoJfXdoaWxlKGIhPTMpOwoJCn0=