List text field dependent of text field
You can use Field Collection module to achieve this.

Using this module you can create group of field, such as class and grade in one collection. Also you can set 'Number of values' to unlimited for field.

Thanks!