#include using namespace std; using ll=long long; int main(){ int n; cin>>n; vector s(n),t(n); for(int i=0;i>s[i]>>t[i]; map dict; for(int i=0;i