Choose the correct pronoun.
The teacher knew it was Sam who/whom was passing notes
The teacher knew it was Sam who/whom was passing notes