Grids with similar class names

Hi, I’m a noob to coding. I placed two grid components one with values 1 and 0 and I wanted to color the grid items of the first grid green and red with the second.
when I use global CSS I couldn’t do this both grids take the same value. I tried using nth-child and nth-type-of but does not work can anyone help me on this.