You can eliminate the relays and the eight AND gates that feed into the S inputs of the flipflops, by making use of the flipflops' clock and D inputs. To do this, connect IN0 to the D inputs of the first flipflop in each bank, IN1 to the second flipflop in each bank and likewise with IN2 and IN3. Then, connect the Set A pushbutton to the clock inputs of the top row of flipflops, and the Set B pushbutton to the clock inputs of the bottom row of flipflops.