One transistor per relay.
Transistor relay pairs in a 4x25 network.
25 digital pins to the 25 horizontal wires of the network.
4 digital pins to the vertical wires of the network.
One microcontroller
A lot of time writing the program.
use a matrix method, 40 i/o lines = 20 by 20 so you can control upto 400 relays!
make sure the relays have diodes in series with the coils.
In the diagram below, replace the switch with your relay coil or better still an opto coupler.