What I am trying to do is to start dfs starting on the first cell of the president's table. If there is another table in that cell's neighbour i call the color function which is also dfs but on the deputy's table and increase the ans (res) by 1.
I do not know what is wrong in this approach. Can anyone help?
UPD: Solved thanks to CodingKnight