#include <iostream>
using namespace std;
string str[10000];
int main(void)
{
int cnt = 0;
while (cin >> str[cnt]) cnt++;
// puts("Test01");
// cout << cnt << endl;
for (int i = 0; i < cnt - 2; i++) {
if (str[i] == str[cnt-2]) cout << str[cnt-1];
else cout << str[i];
// cout << str[i];
cout << " ";
}
return 0;
}