#include using namespace std; const int N = 500000; const long mod = 998244353; bool seen[N]; vector path[N]; unordered_map mp[N], ans[N]; int dfs(int cur){ seen[cur] = true; vector child; for(auto next:path[cur]){ if(!seen[next]) child.push_back(dfs(next)); } for(auto i:child){ for(auto x:ans[i]){ ans[cur][x.first] = max(ans[cur][x.first], x.second); } } return cur; } int main(){ int n; cin >> n; for(int i=0; i> a; for(long p=2; p*p<=a; p++){ while(a%p==0){ mp[i][p]++; a /= p; } } if(a>1) mp[i][a]++; } for(int i=0; i> u >> v; u--, v--; path[u].push_back(v); path[v].push_back(u); } for(int i=0; i