If I were Mary friends, I would tell her that she has to limited the phone screen before sleeping and don't hold the phone while sleeping because the data on the phone may contain the hot heat so it affect to the body and her brain so that's why she can not focus in class. Moreover, when she sleep with the lights on, it's very hard to fall asleep because the room is not dark enough. To sum up, Mary should change her night routine that she can reduce the tired status when she goes to school.