Many to many references problem

Hello, I’m building a portfolio website with Gatsby and Contentful.
I am trying to implement a simple page builder that would allow making custom blocks of content.
For example, I have a project page which has field ‘Components’ that can have multiple references to ‘Media Block’ type. ‘Media block’ has field ‘Content’ which can have multiple references to ‘Media’. ‘Media’ can have one reference to ‘Video’, ‘Image’ or ‘Gif’.
It looks something like this:
Untitled%20Diagram

I am trying to query data like this:

{
      allContentfulProjectPost {
        edges {
          node {
            components {
              ... on ContentfulMediaBlock {
                content {
                  media {
                    media {
    								title
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

However it looks like I am doing something wrong, because only Image returns something. Video and Gif returns null in the query.

What could be the problem?

Thanks!