/**
 * This function takes two grades as input and compares them.
 *
 * @param grade1 A pair containing the grade information of student 1 (subject, grade)
 * @param grade2 A pair containing the grade information of student 2 (subject, grade)
 * @return Indicates whether student 1 has a higher, lower, or equal grade compared to student 2
 */
fun compareGrades(grade1: Pair<String, Int>, grade2: Pair<String, Int>): String {

    return when {
        grade1.first == grade2.first -> {
            when {
                grade1.second > grade2.second -> "Student 1 has a higher grade than Student 2 in the same subject."
                grade1.second < grade2.second -> "Student 1 has a lower grade than Student 2 in the same subject."
                else -> "Student 1 and Student 2 have the same grade in the same subject."
            }
        }
        else -> "Cannot compare grades in different subjects."
    }
}
/**
 * This function takes two grades as input and compares them.
 *
 * @param grade1 A pair containing the grade information of student 1 (subject, grade)
 * @param grade2 A pair containing the grade information of student 2 (subject, grade)
 * @return Indicates whether student 1 has a higher, lower, or equal grade compared to student 2
 */
fun compareGrades(grade1: Pair<String, Int>, grade2: Pair<String, Int>): String {
/**
 * This function takes two grades as input and compares them.
 *
 * @param grade1 A pair containing the grade information of student 1 (subject, grade)
 * @param grade2 A pair containing the grade information of student 2 (subject, grade)
 * @return Indicates whether student 1 has a higher, lower, or equal grade compared to student 2
 */
fun compareGrades(grade1: Pair<String, Int>, grade2: Pair<String, Int>): String {

    return when {
        grade1.first == grade2.first -> {
            when {
                grade1.second > grade2.second -> "Student 1 has a higher grade than Student 2 in the same subject."
                grade1.second < grade2.second -> "Student 1 has a lower grade than Student 2 in the same subject."
                else -> "Student 1 and Student 2 have the same grade in the same subject."
            }
        }
        else -> "Cannot compare grades in different subjects."
    }
}