#K13341. Student Grades Processing

    ID: 23891 Type: Default 1000ms 256MiB

Student Grades Processing

Student Grades Processing

You are given a list of students along with their grades and a list of queries. Each query is a string which can be one of the following:

  • AVG: Calculate the average of all grades and format the result with 2 decimal places (i.e. using the \(\texttt{%.2f}\) format in languages that support it).
  • MAX: Find the maximum grade.
  • MIN: Find the minimum grade.

The program reads input from standard input and writes the answers to standard output. Answer each query in the order provided.

Note: Each result must be output on a new line.

inputFormat

The first line of input contains an integer \(n\) which represents the number of students.

The next \(n\) lines each contain a student's name (a string without spaces) and an integer grade, separated by a space.

The following line contains an integer \(q\) representing the number of queries.

The next \(q\) lines each contain one query, which is one of \(\texttt{AVG}\), \(\texttt{MAX}\), or \(\texttt{MIN}\).

outputFormat

For each query, output the result on a new line. When the query is \(\texttt{AVG}\), the average must be printed with 2 decimal places.

## sample
5
Alice 78
Bob 82
Charlie 91
David 76
Eve 88
3
AVG
MAX
MIN
83.00

91 76

</p>