#include <string> #include <iostream> #include <map> #include <functional> #include <algorithm> #include <vector> #include <cstdio> using namespace std; int n,m; vector<string> nameMap;//index to name vector<vector<string>> tree; map<str...