#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 childs; for(auto next:path[cur]){ if(!seen[next]) childs.push_back(dfs(next)); } for(auto i:childs){ for(auto x:ans[i]){ ans[cur][x.first] = max(ans[cur][x.first], x.second); } } return cur; } int main(){ int n; cin >> n; vector primes; for(int i=2; i<=1000; i++){ bool is_prime = true; for(int p=2; p*p<=i; p++){ if(i%p == 0){ is_prime = false; break; } } if(is_prime) primes.push_back(i); } for(int i=0; i> a; for(auto p:primes){ 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