Yes it's strange. I suppose you could change it like this -
The girl I saw yesterday must have been Julie because her hair was pink.
I saw Julie yesterday and she must have been to the hairdresser's because her hair was pink!
I have to say though it is unlikely that this is what your teacher wants.
Student or Learner