// Try yukicoder // author: Leonardone @ NEETSDKASU #include #include #include using namespace std; int main() { int n; cin >> n; set s; vector t; while (n--) { string a, b; cin >> a >> b; s.insert(a); t.push_back(b); } for (auto b : t) { if (s.find(b) == s.end()) { cout << b << endl; s.insert(b); } } return 0; }