A little simulation

no. What I’m getting at is that you can color them By contact.

First, I would sugfest placing them with a HISM component. Just so they are all instanced properly and part of an object you can always move.

To do that you make a single Actor BP, add the hierarical instance component and script a way to add components to it.

You can place the items however you want in the script. Rows by columns will be easier then going sideways like the numbers you showed.

Then, once that’s done, you modify the sphere object and expand its collision by a little so that you can detect overlaps.
You set the items to detect collisions (physics disabled) and detect overlaps only with themselves.

With that done you can click on any instance and get whatever other instance it comes into contact with by Overlap Event.

That should get you able to color the spheres one by one in whatever order you want by just comparing the location of the spheres you overlap with.
it also provides a reference you can use to shift to the next sphere or object.