hackercupai/hackercup huggingface dataset:
If a grid has only one row or one column, then it's impossible for every tree to be adjacent to two other trees, since the outermost tree(s) can only have one friend. The only exception is if the grid is initially empty, in which case the requirement is vacuously true.

Otherwise, for a grid with at least two rows and columns, notice that filling the entire grid with trees will always leave every tree with at least two friends.

[See David Harmeyer's solution video here.](https://youtu.be/aC0n8sB2BLs)