1-> n cities are given and a threshold is given and there is a bi-directional road between x and y if
x%z==0
y%z==0
z>threshold
Make connections and later they will provide different source and target cities, tell whether a road is there or not(road can be indirect as well).
The solution I gave was run a loop of threshold+1 till n+1, and then make connections with multiplier