gdy is a conjunction. The rest are particles which are glued onto it. Here's a detailed explanation:
I think only plural (masculine personal plural - imagine that it describes the word "ludzie") can serve as a noun. Maybe for some other adjectives it can behave a bit differently, but nothing comes to my mind. I'm just saying that I can't be 100% sure it will always be only that plural. Unless you want to say something like "the poor one", that could possibly work in singular, but that's a different situation.
That's what we have here, "biednym" is the Dative form of "biedni" (possibly also of "biedne", but that would also rather be "the poor ones" about some women).