Rosetta Problems

Disjoint Set of Common Divisors

https://atcoder.jp/contests/abc142/tasks/abc142_d