#include <iostream>
using namespace std;
int main()
{
int x, V[50],i=0;
while(x%5 != 0)
{
cin>>x;
int c = x,pimp=0;
while(c!=0)
{
if(c%2) {pimp++;}
else {pimp--;}
c=c/10;
}
if(pimp == 0)
{
V[i] = x;
i++;
}
}
cout<<endl;
for(int j=0;j<i;j++)
{
cout<<V[j]<<" ";
}
}