Using StoredProcedure to solve logical issues

Please help how can i create a stored procedure to automatically distribute subjects to teachers in diferent classes the classes are S1K,S2B ETC based on days without any duplication. in the table please help


|Days||
|---|---|
|Monday||
|Tuesday||
|Wednesday||
|Thursday||
|Friday||
|Saturday||
|Sunday||
|||
|||
|||
|CLASS||
|S1K||
|S1K||
|S2B||
|S3C||
|||
|Subject||
|Software Engineering||
|Computer Networks||
|Physics||
|Chemistry||
|Mathematics||
|Applied Mechanics||
|||
|||
|List of teachers|No|
|MUKASA JOHN|2-0001|
|MUKISA PAUL|2-0002|