#include <iostream>
using namespace std;
int main()
{
int tab[7];
int n;
for(int i = 0 ;i<=7; i++){
cin>>n;
tab[i]=n;
}
for(int i = 7; i >=0; i--){
cout<<tab[i]<<", ";
}
cout<<endl;
for(int i = 7; i >=0; i--){
if(tab[i]%2==0){
cout<<tab[i]<<", ";
}
}
return 0;
}