#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
string a[105];
int main()
{
string s;
int n=0;
while(cin>>s)
{
a[n++]=s;
}
for(int i=1;i<=n-2;++i)
{
if(a[i]==a[n-1])
{
cout<<a[n]<<" ";
}
else
{
cout<<a[i]<<" ";
}
}
return 0;
}