Find all possible values of $k $ such that there exist a $k\times k$ table colored in $k$ colors such that there do not exist two cells in a column or a row with the same color or four cells made of intersecting two columns and two rows painted in exactly three colors.