#include using namespace std; int main() { int N; cin >> N; vector names; set cheat; for (int i = 0; i < N; i++) { string s, t; cin >> s >> t; cheat.insert(s); names.push_back(s); names.push_back(t); } for (auto &x : names) { if (!cheat.count(x)) { cout << x << endl; cheat.insert(x); } } }