while true
    n = gets.to_i
    break if n == 0
    h = {}
    1.upto(n-1){|x| h[(x * x) % n] = true}
    arr = h.keys.sort
    arr2 = Array.new((n - 1) / 2, 0)
    arr.combination(2){|a, b|
        d = b - a
        d = n - d if d > (n - 1) / 2
        arr2[d - 1] += 2
    }
    puts arr2
end
