#include #define int long long using namespace std; const int MOD = 1000000007; signed main() { int N; cin >> N; set A; vector B(N); for( int i = 0; i < N; i++ ){ string a; cin >> a >> B.at(i); A.insert(a); } vector ans; for( int i = 0; i < N; i++ ){ if( A.count(B.at(i)) ) continue; else ans.push_back(B.at(i)); } ans.erase(unique(ans.begin(), ans.end()), ans.end()); for( int i = 0; i < ans.size(); i++ ) cout << ans.at(i) << endl; }