from math import * def f(n): return int(193.5 - 89 * sin(radians(77 * n))) def bernt(n): p, m, t, l = 1, 1, n, f(n) while t != l: if p == m: t, p, m = l, 2 * p, 0 l = f(l) m += 1 t, l = n, n for _ in range(m): l = f(l) u = 0 while t != l: t, l, u = f(t), f(l), u + 1 return [u, t, m] for n in 94, 124, 178, 235, 418, 517, 601, 759, 893, 947,186, 214, 243, 454, 545, 612, 811, 966, 1265: print(n, bernt(n))