Queue at the School

CodeForces - 266B