let say i have a group of kids that get to pick out their three favorite toys. Because the number of toy available is limited, only the kids with he highest grade get their #1 choice 1. the rest get their 2nd or 3rd choice depend on their grade and availability.
[TABLE="width: 576"]
<tbody>[TR]
[TD]kids[/TD]
[TD]grade[/TD]
[TD]# 1 choice1[/TD]
[TD]# 2 choice2[/TD]
[TD]# 3 choice[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy[/TD]
[TD]availble[/TD]
[/TR]
[TR]
[TD]k1[/TD]
[TD]a[/TD]
[TD]toy 1[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy 1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]k2[/TD]
[TD]b[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy 2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]k3[/TD]
[TD]c[/TD]
[TD]toy 3[/TD]
[TD]toy 2[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy 3[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]k4[/TD]
[TD]b[/TD]
[TD]toy 1[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]k5[/TD]
[TD]a[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]k6[/TD]
[TD]b[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 576"]
<tbody>[TR]
[TD]kids[/TD]
[TD]grade[/TD]
[TD]# 1 choice1[/TD]
[TD]# 2 choice2[/TD]
[TD]# 3 choice[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy[/TD]
[TD]availble[/TD]
[/TR]
[TR]
[TD]k1[/TD]
[TD]a[/TD]
[TD]toy 1[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy 1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]k2[/TD]
[TD]b[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy 2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]k3[/TD]
[TD]c[/TD]
[TD]toy 3[/TD]
[TD]toy 2[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD]toy 3[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]k4[/TD]
[TD]b[/TD]
[TD]toy 1[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]k5[/TD]
[TD]a[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]k6[/TD]
[TD]b[/TD]
[TD]toy 2[/TD]
[TD]toy 3[/TD]
[TD]toy 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]