main=interact$unlines.map(1#).lines (%)=take n#x|([1..div(length x)n]>>n%x)/=x=(n+1)#x|1>0=n%x