On a rectangular table, there are equal cardboard squares of different colors with sides parallel to the sides of the table. If any squares of different colors are considered, then some two of them can be nailed to the table with a single nail. Prove that all squares of a certain color can be nailed to the table with nails.