#include #include #include using namespace std; typedef long long ll; typedef pair P; typedef pair P1; typedef pair P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define mod 1000000007 #define fi first #define sc second #define rep(i,x) for(int i=0;ivec; setS,s; int main(){ cin >> n; rep(i,n){ string a,b; cin >> a >> b; S.insert(a); if(s.find(b) == s.end()) vec.pb(b); s.insert(b); } rep(i,vec.size()){ if(S.find(vec[i]) == S.end()) cout << vec[i] << endl; } }