In theory, it should work with all of them, but in practice it's messy and clunky as all of them use ActivityPub in subtly different ways, with their own extensions and quirks.
Also Lemmy versions pre 0.18 (i want to say, unsure) won't work with GoToSocial or Mastodon instances with secure mode enabled. The recent versions should though.