#include <bits/stdc++.h>   using namespace std;   map<string, string> mp;   set<string> st;   int n;   char in[30];   string read() {     scanf(  %s , in);     return (string)in;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i += 1) {       string a = read();       string b = read();       if (st.find(b) != st.end()) {         continue;       }       st.insert(a);       if (mp.find(a) != mp.end()) {         mp[b] = mp[a];         mp.erase(a);         continue;       }       mp[b] = a;     }     printf( %d n , mp.size());     for (auto x : mp) {       if (x.second ==  _ ) {         continue;       }       printf( %s %s n , x.second.c_str(), x.first.c_str());     }   }   