Suppose that we have n3n \geqslant 3 distinct colours. Let f(n)f(n) be the greatest integer with the property that every side and every diagonal of a convex polygon with f(n)f(n) vertices can be coloured with one of nn colours in the following way:

Show that f(n)(n1)2f(n) \leqslant (n - 1)^2 with equality for infinitely many values of nn.