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