#include #include #include using namespace std; int main(){ int n;cin>>n; set s1; vector s2; set sa; for(int i = 0; n > i; i++){ string a,b;cin>>a>>b; s1.insert(a); s2.push_back(b); sa.insert(a); sa.insert(b); } set z; for(int i = 0; s2.size() > i; i++){ if(s1.find(s2[i]) == s1.end() && z.find(s2[i]) == z.end()){ cout << s2[i] << endl; z.insert(s2[i]); } } }