Ellen, I agree. Problems like this seem very big and insurmountable. You forgot because it is easy to get distracted. However, it is not earth shattering and the implications are not too difficult.
1. First thing tomorrow, go and tell the other class. Make it your priority.
2. Go to the teacher and admit what happened, but you have now dealt with it. Suggest that this may lead to some unfairness and you may need jointly to come up with a solution, selection or ballot or something like that.
I'm a bit confused about where the letters are for the people who don't know about it. Do you have them? If so, you can deal with it fairly quickly. If not, the teacher has let you down and the unfairness is not within your control.