Replacing data

Hi,

I Have data as below
Schedule
Date Lesson Teacher
2018-01-03 Math
2018-01-03 English
2018-01-03 Sports
2018-01-03 Biology
2018-01-03 Math
2018-01-03 English
2018-01-03 Sports
2018-01-03 Biology
2018-01-04 Math
2018-01-04 English
2018-01-04 Sports
2018-01-04 Biology

Teacher
Lesson Teacher Priority
Math Alex 1
Math Bob 2
Math Steve 3

English Alex 1
English Bertha 2

Sports Noah 1
Sports Steve 2

Biology Bertha 1
Biology Bob 2

Every teacher only can teach 1 lesson in a date, so if the schedule already filled with first priority teacher the next will be fill with the second in the same date of lesson schedule. Does anyone can help?

thx

case closed..already find the way out thanks alot....