Say, we have a semimagic square $X$, that is, an $n\times n$ square matrix with entries from natural numbers, such that each row and column of it sums up to the same natural number $s$. Let $M$ be a set with $s$ elements. To each $X_{ij}$, we assign a subset $M_{ij}$ of $M$ with $X_{ij}$ elements.
Question: Is it possible to make the assignment in such a way, that for every $i$ we have $\bigcup_j M_{ij} = M$ and for every $j$ we have $\bigcup_i M_{ij} = M$, or equivalently, whenever the cells $X_{ij}$ and $X_{kl}$ lie in the same row or in the same column, then the subsets $M_{ij}$ and $M_{kl}$ are disjoint?
PS1: You may think of $s^2$ different balls, each labeled by a number from ${\left\lbrace 1,\dots,s \right\rbrace}$, such that for each label $l$, there are exactly $s$ balls having label $l$. You have to distribute the balls in the cells of $X$ in such a way, that in each cell $X_{ij}$ there are $X_{ij}$ balls and in each row and column of $X$ we have a whole set of balls labeled from $1$ to $s$.
PS2: To me, the answer to the question seems to be positive. However, the greedy construction idea does not work.

