#include using namespace std; typedef long long ll; typedef pair pp; const int INF = 1e9; const int MOD = 1000000007; #define rep(i,n) for(int i=0;i> n; vector a(n); set st; rep(i,n){ string p,q; cin >> p >> q; st.insert(p); a[i] = q; } vector ans; for(string p:a){ if(st.find(p) == st.end()){ ans.push_back(p); st.insert(p); } } for(string p:ans) cout << p << endl; return 0; }