#include <iostream>
using namespace std;
int main()
{
int x;
int ile=0;
do{
cin>>x;
if(x==2)ile++;
cout<<x<<" ";
}
while(ile<3);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewogaW50IHg7CiAgICBpbnQgaWxlPTA7CiAgICAgIGRvewogICAgICAgICBjaW4+Png7CiAgICAJaWYoeD09MilpbGUrKzsKICAgIAljb3V0PDx4PDwiICI7CiAgCiAgICAgICB9CiAgICAgICAgICAgd2hpbGUoaWxlPDMpOwogICAgIAogICAgICAgCglyZXR1cm4gMDsKfQ==