def next(x, y, z, n):
    return y, z, (x+y+z)%n

if __name__ == "__main__":
    x0, y0, z0 = 0, 0, 1

    res = {}
    for n in range(2, 201):
        x, y, z = x0, y0, z0
        ctr = 0
        while True:
            ctr += 1
            x, y, z = next(x, y, z, n)
            if x == x0 and y == y0 and z == z0:
                print(n, ctr)
                res[n] = ctr
                break

    for n in {k: v for k, v in sorted(res.items(), key=lambda item: item[1])}:
        #print(n, res[n])
        print(f"{n}, ", end = "")