#include #include #include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector candidates; set cheaters; string s; for (int i = 0; i < n; ++i) { cin >> s; cheaters.insert(s); cin >> s; candidates.push_back(s); } set named; for (int i = 0; i < candidates.size(); ++i) { if (cheaters.count(candidates[i]) == 0 && named.count(candidates[i]) == 0) cout << candidates[i] << endl; named.insert(candidates[i]); } return 0; }