You are asked to dissect an $N \times N$ square into polyomino pieces such that each piece shares portion of its boundary with exactly $D$ other pieces, and no piece has area exceeding $N$. This can be achieved for $D \le 5$.
For $D=2, 3, 4$ the smallest such squares are of size $2 \times 2$, $3 \times 3$, $4 \times 4$, respectively:
Find the smallest square for $D=5$.
Credit: inspired by this puzzle.